home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- * *
- * Filename : ParseArgs.c *
- * *
- * Description : Fetches and parses startup arguments from WB or a shell. *
- * *
- ***************************************************************************
- * *
- * Modification History *
- * *
- * Date Author Comments *
- * ---------------------------------------------------------------------- *
- * 10.6.93 R.Bödi Created. *
- * 15.2.94 R.Bödi Due to changes in SAS/C 6.50 it was possible *
- * to merge parsing of CLI and WB arguments into *
- * a single routine (see _WBArgc and _WBargv *
- * variables defined in dos.h). *
- * *
- ***************************************************************************
- * *
- * Copyright © 1993-1994 Richard Bödi, All rights reserved. *
- * *
- ***************************************************************************/
-
- /*----------------------------- INCLUDES ----------------------------------*/
-
- #include "TeXPrt.h"
- #include "TexPrt_protos.h"
- #include "TexPrt_globals.h"
-
- /*-------------------------- GLOBAL DATA ----------------------------------*/
-
- char *Keywords[] = { "SHELL", "FILE", "APPICON" };
- char *Switchs[] = { "/K", "/K", "/K" };
-
- /*------------------------------- CODE ------------------------------------*/
-
- /***************************************************************************
- * *
- * Function name : ParseWB *
- * *
- * Description : Gets the filename of the icon which has been clicked *
- * first. This file is assumed to be the DVI file which *
- * has to be printed. Also fetches and parses the ToolTypes *
- * from the TeXPrt icon. *
- * Allowed tooltypes are : *
- * SHELL (Specifies the shell for the DVI printer driver *
- * output, e.g. newshell CON:20/340/660/150). *
- * APPICON (Specifies the icon file for the AppIcon.) *
- * *
- ***************************************************************************
- * *
- * Synopsis : ParseWB (WBArgStr) *
- * *
- * Parameters : *
- * (struct WBStartup **) WBArgStr : The WB argument string. *
- * *
- * Return value : None *
- * *
- ***************************************************************************/
-
- void ParseWB (struct WBStartup *WBArgStr)
-
- {
- struct DiskObject *DiskObj;
- struct WBArg *WBArg;
- char Buffer[FMSIZE];
- char **ToolArray;
-
-
- WBArg = WBArgStr->sm_ArgList;
-
- if (WBArg->wa_Name) // get tooltypes
- if (DiskObj = GetDiskObject (WBArg->wa_Name))
- {
- ToolArray = (char **)DiskObj->do_ToolTypes;
- stpcpy (Args.ArgStr[KW_SHELL], FindToolType (ToolArray, Keywords[KW_SHELL]));
- stpcpy (Args.ArgStr[KW_APPICON], FindToolType (ToolArray, Keywords[KW_APPICON]));
- FreeDiskObject (DiskObj);
- }
-
- WBArg++;
-
- if (WBArg->wa_Lock) // get filename
- {
- NameFromLock (WBArg->wa_Lock, Buffer, sizeof (Buffer));
- strmfp (Args.ArgStr[KW_FILE], Buffer, WBArg->wa_Name);
- }
- }
-
-
-
- /***************************************************************************
- * *
- * Function name : ParseShell *
- * *
- * Description : Parses the commandline for parameters. *
- * Allowed parameters are : *
- * SHELL/K (Specifies the shell for the DVI printer *
- * driver output, e.g. newshell CON://660/150). *
- * FILE/K (Specifies the DVI File.) *
- * APPICON/K (Specifies the icon file for the AppIcon.) *
- * *
- ***************************************************************************
- * *
- * Synopsis : ParseShell (NoOfArgs, Arg) *
- * *
- * Parameters : *
- *
- * (char **) Arg : The shell argument string. *
- * *
- * Return value : None *
- * *
- ***************************************************************************/
-
- void ParseShell (int NoOfArgs, char **Arg)
-
- {
- int kword;
- struct RDArgs *RDArgs;
- char Template[CMDSTRLENGTH];
-
-
- for (kword = 0, Template[0] = 0; kword < LAST_KW; kword++)
- {
- if (Template[0])
- strcat (Template, ",");
- strcat (Template, Keywords[kword]);
- strcat (Template, Switchs[kword]);
- }
-
- if (RDArgs = ReadArgs (Template, Args.ArgPtr, NULL))
- {
- for (kword = 0; kword < LAST_KW; kword++)
- if (Args.ArgPtr[kword])
- stpcpy (Args.ArgStr[kword], (char *)Args.ArgPtr[kword]);
- }
- else
- PrintFault (IoErr (), "Error reading arguments");
-
- FreeArgs (RDArgs);
- }
-
-
-
- /*---------------------------- END OF FILE --------------------------------*/
-