Initial import of Scalos. To decrease size I have
[AROS-Contrib.git] / scalos / Modules / FormatDisk.Gadtools / ParseArgs.c
blobacfcedb9f136fd345c2b440f17a518c7a2ee1680
1 // ParseArgs.c
2 // $Date$
3 // $Revision$
4 // $Id$
7 #include <string.h>
8 #include <stdio.h>
10 #include <exec/types.h>
11 #include <dos/dos.h>
12 // #include <dos/filehandler.h>
13 // #include <workbench/startup.h>
14 // #include <libraries/gadtools.h>
15 // #include <workbench/icon.h>
16 // #include <devices/trackdisk.h>
17 #include <dos/rdargs.h>
19 // Prototypes for system functions
20 #include <proto/exec.h>
21 #include <proto/dos.h>
23 // Other headers
24 #include "Format.h"
25 #include "GUI.h"
26 #include <defs.h>
28 extern SIPTR args[];
30 // Get the command-line arguments given by the user, by using ReadArgs()
31 void parseArgs(char *drive,char *newName,BOOL *ffs,BOOL *intl, BOOL *icons, char *TrashName, BOOL *quick, BOOL *verify)
33 APTR r;
35 // Get the arguments
36 r=ReadArgs("DRIVE/K/A,NAME/K/A,FFS/S,INTL=INTERNATIONAL/S,NOICONS/S,QUICK/S,NOVERIFY/S/TRASCHCAN/N",args, NULL);
38 // If the user didnt specify a drive name, print an error
39 if(args[0] == 0L)
41 printError("You need to specify a drive to format",NULL,NULL);
42 if(r != NULL)
43 FreeArgs(r);
44 cleanup(200);
46 else
47 strcpy(drive,(char *)args[0]);
49 // Likewise for a name for the newly formatted volume
50 if(args[1]==0L)
52 printError("You need to specify a name for the volume",NULL,NULL);
53 cleanup(200);
55 else
56 strcpy(newName,(char *)args[1]);
58 // Get the four togglable settings
59 *ffs=(args[2]!=0);
60 *intl=(args[3]!=0);
61 *icons=(args[4]==0);
63 if(args[5]==0L)
64 strcpy(TrashName, "Trashcan");
65 else
66 strcpy(TrashName,(char *)args[5]);
68 *quick=(args[6]!=0);
69 *verify=(args[7]==0);
71 // Were done, so free the ReadArgs result
72 FreeArgs(r);
74 // And return
75 return;