home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / utils / getobj / getobj.c next >
Encoding:
C/C++ Source or Header  |  1992-12-26  |  1.2 KB  |  63 lines

  1. #include <exec/types.h>
  2. #include <libraries/dos.h>
  3. #include <workbench/workbench.h>
  4. #include <workbench/startup.h>
  5.  
  6. #include <clib/alib_protos.h>
  7. #include <clib/exec_protos.h>
  8. #include <clib/dos_protos.h>
  9. #include <clib/icon_protos.h>
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. #include <string.h>
  13. struct Library *IconBase=NULL;
  14. void sr(char *s);
  15.  
  16. main(int argc,char *argv[])
  17. {
  18.   char name[200];
  19.   char *s;
  20.   struct DiskObject *dobj;
  21.   char *olddeftool;
  22.   char **oldtooltypes;
  23.   BOOL success=FALSE;
  24.   if(argc!=2)
  25.   {
  26.      printf("GetObj version 1.0, written by Joseph Hodge\n");
  27.      printf("\n\n");
  28.      exit(0);
  29.   }
  30.   strcpy(name,argv[1]);
  31.  
  32.  
  33.   sr(name);
  34.  
  35.   IconBase=OpenLibrary("icon.library",0L);
  36.   if(dobj=GetDiskObject(name))
  37.   {
  38.     printf("Found Object\n");
  39.     oldtooltypes=dobj->do_ToolType;
  40.     olddeftool=dobj->do_DefaultTool;
  41.     
  42.     while(s=(char *)FindToolType(oldtooltypes,"DLPATH"))
  43.     {
  44.        strcpy(name,s);
  45.        printf("ToolType= %s.\n",name);
  46.     }
  47.     FreeDiskObject(dobj);
  48.   }
  49.   CloseLibrary(IconBase);
  50.   exit(0);
  51. }
  52.  
  53. void sr(char *s)
  54. {
  55.    register int i;
  56.    i=strlen(s)-1;
  57.    while(i>-1)
  58.    {
  59.      if(*(s+i)<=32) *(s+i)='\0'; else break;
  60.      i--;
  61.    }
  62. }
  63.