use m4_normalize on the output strings to remove trailing spaces/tabs and consolidate...
[AROS.git] / workbench / c / HDTool / setup.c
blobabd6b19ff108e29439f50b0f5cf798c04276eb5e
1 #include <string.h>
2 #include <stdio.h>
3 #include <proto/dos.h>
4 #include "setup.h"
6 char *setuptemplate = "DEVICE/K/A,UNIT/K/N/A,PARTITION/K,SCRIPT/K";
8 LONG setup(char *name, STRPTR args) {
9 BOOL retval = RETURN_FAIL;
10 IPTR myargs[]={0,0,0,0};
11 struct RDArgs *rdargs;
12 struct RDArgs rda = {{args, strlen(args), 0}, 0, 0, 0, NULL, 0};
14 rda.RDA_Source.CS_Buffer[rda.RDA_Source.CS_Length]='\n';
15 rdargs = ReadArgs(setuptemplate,myargs, &rda);
16 if (rdargs)
18 printf
20 "setup\n\tdevice=%s unit=%ld\n",
21 (STRPTR)myargs[0], (long)*(LONG *)myargs[1]
23 if (myargs[2])
25 printf("\ttable in partition=%s\n", (STRPTR)myargs[2]);
27 else
28 printf("\ttable in whole HD\n");
29 if (myargs[3])
31 printf("\tscipt is %s\n", (STRPTR)myargs[3]);
33 else
34 printf("\tinteractive\n");
35 FreeArgs(rdargs);
37 else
38 PrintFault(IoErr(), name);
39 return retval;