- DPRINTF (("Flag: %s", flagname));
- opt = identifyFlag (flagname);
- DPRINTF (("Flag: %s", flagcode_unparse (opt)));
-
- if (flagcode_isSkip (opt))
- {
- DPRINTF (("Skipping!"));
- }
- else if (flagcode_isInvalid (opt))
- {
- DPRINTF (("Invalid: %s", flagname));
-
- if (isMode (flagname))
- {
- context_setMode (flagname);
- }
- else
- {
- DPRINTF (("Error!"));
- voptgenerror (FLG_BADFLAG,
- message ("Unrecognized option: %s",
- cstring_fromChars (thisarg)),
- g_currentloc);
- }
- }
- else
- {
- context_userSetFlag (opt, set);
-
- if (flagcode_hasArgument (opt))
- {
- if (opt == FLG_HELP)
- {
- showhelp = TRUE;
- }
- else if (flagcode_isPassThrough (opt)) /* -D or -U */
- {
- passThroughArgs = cstringSList_add
- (passThroughArgs, cstring_fromChars (thisarg));
- }
- else if (flagcode_hasValue (opt))
- {
- if (++i < argc)
- {
- setValueFlag (opt, cstring_fromChars (argv[i]));
- }
- else
- {
- llfatalerror
- (message
- ("Flag %s must be followed by a number",
- flagcode_unparse (opt)));
- }
- }
- else if (opt == FLG_INCLUDEPATH || opt == FLG_SPECPATH)
- {
- cstring dir = cstring_suffix (cstring_fromChars (thisarg), 1); /* skip over I */
-
- switch (opt)
- {
- case FLG_INCLUDEPATH:
- cppAddIncludeDir (dir);
- /*@switchbreak@*/ break;
- case FLG_SPECPATH:
- /*@-mustfree@*/
- g_localSpecPath = cstring_toCharsSafe
- (message ("%s%h%s",
- cstring_fromChars (g_localSpecPath),
- PATH_SEPARATOR,
- dir));
- /*@=mustfree@*/
- /*@switchbreak@*/ break;
- BADDEFAULT;
- }
- }
- else if (flagcode_hasString (opt)
- || opt == FLG_INIT || opt == FLG_OPTF)
- {
- if (++i < argc)
- {
- cstring arg = cstring_fromChars (argv[i]);
-
- if (opt == FLG_OPTF)
- {
- ; /* -f already processed */
- }
- else if (opt == FLG_INIT)
- {
-# ifndef NOLCL
- initFile = inputStream_create
- (arg,
- cstring_makeLiteralTemp (LCLINIT_SUFFIX),
- FALSE);
-# endif
- break;
- }
- else
- {
- DPRINTF (("String flag: %s / %s",
- flagcode_unparse (opt), arg));
- if (opt == FLG_MTSFILE)
- {
- /*
- ** arg identifies mts files
- */
-
- addFile (mtfiles, message ("%s%s", arg, MTS_EXTENSION));
- addXHFile (xfiles, message ("%s%s", arg, XH_EXTENSION));
- }
- else
- {
- setStringFlag (opt, arg);
- }
- }
- }
- else
- {
- llfatalerror
- (message
- ("Flag %s must be followed by a string",
- flagcode_unparse (opt)));
- }
- }
- else
- {
- /* no argument */
- }
- }
- }
- }
- else /* its a filename */
- {
- DPRINTF (("Adding filename: %s", thisarg));
- fl = cstringSList_add (fl, cstring_fromChars (thisarg));
- }