#include "pz.h" /* IFF2PCS input argument parsing from CLI or Workbench. ** This code should also put up a requester if no argument is specified... ** But doesn't yet. ** Ali Ozer, Nov 1987 */ /* If called from CLI, argc > 0 and *argv contains program name and arguments. ** If called from WB, argc == 0 and msg points to the arguments. ** Note that ParseFile returns an AmigaDOS file handle as opposed to a C ** file handle. ParseFile will either NOT return or return NULL if something ** goes wrong. */ struct FileHandle *ParseArgs (argc, argv, msg) int argc; char **argv; struct WBStartup *msg; { struct WBArg *arg; struct FileHandle *fp = NULL; if (argc != 0) { /* Running from the CLI */ if (argc != 2) Panic ("Usage: IFF2PCS ifffilename"); else fp = Open (argv[1], MODE_OLDFILE); } else { /* Else a WB argument... */ if ((msg == NULL) || (msg->sm_NumArgs < 2) || ((arg = (msg->sm_ArgList)+1) == NULL)) Panic ("You need to specify a file (See IFF2PCS.DOC)"); else { struct Lock *olddir = CurrentDir (arg->wa_Lock); fp = Open (arg->wa_Name, MODE_OLDFILE); if (olddir) CurrentDir (olddir); } } return (fp); }