VistaIOParseFilterCmd(3) | Library Functions Manual | VistaIOParseFilterCmd(3) |
VistaIOParseFilterCmd - parse command line options and filenames
#include <vistaio.h>
void VistaIOParseFilterCmd (noptions, options, argc, argv, input, output)
int noptions, argc; VistaIOOptionDescRec options[noptions]; char *argv; FILE *input; FILE *output;
VistaIOParseFilterCmd is used to parse command line options and filenames for most Vista programs. It implements the standard Vista command line options -help, -in, and -out, and reports all errors in parsing or in attempting to open the input and output files. Its major limitation is that it allows at most one input file and one output file.
Options particular to a program are specified in a table given by the noptions and options arguments. See the VistaIOoption(3) manual page for the form of this table.
The argc and argv arguments to VistaIOParseFilterCmd are normally identical to the parameters of the program's main function.
VistaIOParseFilterCmd uses the first command line argument, argv[0], in a call to VistaIOSetProgramName(3) to record the program's name for future error messages.
The remaining command line arguments are then processed sequentially. An argument is examined to determine whether it is an initial substring of any option keyword defined in the options table. If so, arguments following the keyword may be parsed as values associated with the option. The values are stored at locations specified by the options table.
In addition to the options specified by the options table, VistaIOParseFilterCmd recognizes the options -help, -in, and -out. When it encounters -help, VistaIOParseFilterCmd prints the command usage information and exits. The -in and -out arguments are used to identify input and output files, as is standard for Vista programs.
VistaIOParseCommand(3), VistaIOIdentifyFiles(3), VistaIOoption(3),
VistaIOParseFilterCmd may modify the argv vector of command line arguments.
VistaIOParseFilterCmd reports errors in command line options by printing directly to the standard error stream. For all major errors, VistaIOParseFilterCmd also exits the program with a status code of 1 rather than return to the caller. Error reports include the program name obtained from argv[0]. The following messages may be produced:
David Lowe <lowe@cs.ubc.ca>
Adaption to vistaio: Gert Wollny <gw.fossdev@gmail.com>
28 January 1994 | VistaIO Version 1.2.14 |