2 Copyright © 2004-2010, The AROS Development Team. All rights reserved.
6 #include <dos/rdargs.h>
7 #include <workbench/startup.h>
10 #include <proto/icon.h>
15 /*** Global Variables *******************************************************/
16 STATIC CONST_STRPTR TEMPLATE
= "FROM,USE/S,SAVE/S";
17 STATIC IPTR args
[COUNT
];
18 STATIC
struct RDArgs
*rdargs
;
19 STATIC BPTR olddir
= (BPTR
)-1;
21 /*** Functions **************************************************************/
22 BOOL
ReadArguments(int argc
, char **argv
)
26 rdargs
= ReadArgs(TEMPLATE
, args
, NULL
);
27 return rdargs
!= NULL
;
31 struct WBStartup
*wbmsg
= (struct WBStartup
*)argv
;
32 struct WBArg
*wbarg
= wbmsg
->sm_ArgList
;
33 struct DiskObject
*dobj
;
37 if (wbmsg
->sm_NumArgs
> 1)
40 if (wbarg
->wa_Lock
&& *wbarg
->wa_Name
)
42 olddir
= CurrentDir(wbarg
->wa_Lock
);
43 dobj
= GetDiskObject(wbarg
->wa_Name
);
46 args
[FROM
] = (IPTR
)wbarg
->wa_Name
;
47 toolarray
= dobj
->do_ToolTypes
;
48 tooltype
= FindToolType(toolarray
, "ACTION");
51 if (MatchToolValue(tooltype
, "USE"))
55 else if (MatchToolValue(tooltype
, "SAVE"))
65 ShowMessage("Couldn't read DiskObject\n");
69 else if (wbmsg
->sm_NumArgs
== 1)
77 VOID
FreeArguments(VOID
)
80 if (olddir
!= (BPTR
)-1)
84 IPTR
GetArgument(enum Argument id
)
86 if (id
>= 0 && id
< COUNT
) return args
[id
];