NAME¶
VistaIOReportBadArgs - report unrecognized command line arguments
SYNOPSIS¶
#include <vistaio.h>
void VistaIOReportBadArgs ( argc, argv)
ARGUMENTS¶
- argc
- Specifies the number of unrecognized command line arguments.
- argv
- Specifies a vector of unrecognized command line arguments.
DESCRIPTION¶
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.
EXAMPLES¶
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))
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);
}
...
}
SEE ALSO¶
VistaIOParseCommand(3),
VistaIOReportUsage(3),
VistaIOoption(3),
AUTHOR¶
Art Pope <pope@cs.ubc.ca>
Adaption to vistaio: Gert Wollny <gw.fossdev@gmail.com>