home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / tools / system / format64 / source / parseargs.c < prev   
Encoding:
C/C++ Source or Header  |  1998-04-20  |  1.9 KB  |  76 lines

  1. #include <exec/types.h>
  2. #include <exec/exec.h>
  3. #include <intuition/intuition.h>
  4. #include <dos/dos.h>
  5. #include <dos/filehandler.h>
  6. #include <workbench/startup.h>
  7. #include <libraries/gadtools.h>
  8. #include <workbench/icon.h>
  9. #include <devices/trackdisk.h>
  10. #include <dos/rdargs.h>
  11.  
  12. /*Prototypes for system functions*/
  13. #include <proto/exec.h>
  14. #include <proto/intuition.h>
  15. #include <proto/dos.h>
  16. #include <proto/gadtools.h>
  17. #include <proto/icon.h>
  18. #include <proto/graphics.h>
  19.  
  20. /*Other headers*/
  21. #include "Format.h"
  22. #include "gui.h"
  23. #include "string.h"
  24. #include "stdio.h"
  25.  
  26. extern BOOL FFS = FALSE;
  27. extern BOOL QuickFmt = FALSE;
  28. extern BOOL Verify = TRUE;
  29. extern BOOL Icon = TRUE;
  30. extern struct Library *ibase = NULL;
  31. extern struct Library *gbase = NULL;
  32. extern struct Library *GadToolsBase = NULL;
  33. extern struct Library *IconBase = NULL;
  34. extern BPTR StdErr = NULL;
  35. extern LONG args[];
  36. extern struct WBStartup *WBenchMsg;
  37.  
  38. /*Get the command-line arguments given by the user, by using ReadArgs()*/
  39. void parseArgs(char *drive,char *newName,BOOL *ffs,BOOL *intl,BOOL *icons,BOOL *quick, BOOL *verify)
  40.     {
  41.    APTR r;
  42.  
  43.    /*Get the arguments*/
  44.    r=ReadArgs("DRIVE/K/A,NAME/K/A,FFS/S,INTL=INTERNATIONAL/S,NOICONS/S,QUICK/S,NOVERIFY/S",args, NULL);
  45.  
  46.    /*If the user didnt specify a drive name, print an error*/
  47.    if(args[0] == NULL)
  48.         {
  49.       printError("You need to specify a drive to format",NULL,NULL);
  50.       if(r != NULL) FreeArgs(r);
  51.         cleanup(200);
  52.         }
  53.    else strcpy(drive,(char *)args[0]);
  54.  
  55.    /*Likewise for a name for the newly formatted volume*/
  56.    if(args[1]==NULL)
  57.         {
  58.       printError("You need to specify a name for the volume",NULL,NULL);
  59.       cleanup(200);
  60.         }
  61.     else strcpy(newName,(char *)args[1]);
  62.  
  63.    /*Get the four togglable settings*/
  64.    *ffs=(args[2]!=0);
  65.     *intl=(args[3]!=0);
  66.    *icons=(args[4]==0);
  67.    *quick=(args[5]!=0);
  68.    *verify=(args[6]==0);
  69.  
  70.    /*Were done, so free the ReadArgs result*/
  71.    FreeArgs(r);
  72.  
  73.    /*And return*/
  74.    return;
  75.     }
  76.