Report unrecognized command line arguments
#include <vistaio.h> void VistaIOReportBadArgs (argc, argv) int argc; char *argv;
Specifies the number of unrecognized command line arguments.
Specifies a vector of unrecognized command line arguments.
VistaIOReportBadArgs is usually called after VistaIOParseCommand has indicated a problem parsing command line arguments. It prints a message listing those arguments that VistaIOParseCommand could not comprehend.
VistaIOParseCommand leaves the program name and any unrecognized arguments in the first argc entries of the argv vector. VistaIOReportBadArgs finds them there: it assumes that argv[0] contains the program's name, and that argv[1] through argv[argc - 1] are the arguments that could not be parsed. The message it prints to the standard error stream is of the form:
program: Unrecognized arguments: arg1 arg2 ...
where program is the first element of argv and arg1, arg2, etc. are the remaining elements.
The following code fragment parses command line arguments using VistaIOParseCommand. Any arguments not recognized by VistaIOParseCommand are then parsed by some other means (e.g., by XtDisplayInitialize(3Xt)). Finally, if any arguments remain, having not been recognized during either parsing, they are printed along with information on the valid program options.
#include <vistaio.h> static VistaIOOptionDescRec options[] = { /* option table entries */ }; int main (int argc, char *argv) { if (! VistaIOParseCommand (VistaIONumber (options), options, & argc, argv)) goto Usage;
Parse arguments remaining in argv[1] ... argv[argc - 1].
if (argc > 1) {
VistaIOReportBadArgs (argc, argv);
Usage:
VistaIOReportUsage (argv[0], VistaIONumber (options), options, NULL); fprintf (stderr, " plus any X Windows options.\n\n"); exit (1);
}
...
}
Art Pope <[email protected]>
Adaption to vistaio: Gert Wollny <[email protected]>