CL_CPARSE - parse a command line using an Options Table.

Usage:

#include <cl.h>
cl = cl_cparse(argc, argv, optab, header);

Where:

int argc;
is the number of arguments on the command line.
char **argv;
points to a list of the arguments on the command line.
CL_DESCRIPTION *optab;
is an Options Table describing the possible arguments and options accepted on the command line.
char *header;
points to a string that should be output at the beginning of any error diagnostics.
CL_PARSED *cl;
points to a data structure containing the parsed command line.

Description:

The "cl_cparse" function parses a command line, in the same way as "cl_parse". For more information, see "expl c internal parser cl_parse".

"cl_cparse" automatically checks the command line to see if it contains the option +HELP or -HELP. If so, "cl_cparse" calls "cl_usage" to print out usage information on "stdout", then calls "exit" to terminate the program with an EXIT_SUCCESS status.

If there is no +HELP or -HELP, "cl_cparse" calls the "cl_errors" function to determine if any errors were encountered during the parsing process. If there were errors, "cl_errors" automatically outputs appropriate error diagnostics to "stderr". It uses the specified header string as a heading line for the diagnostic messages. Once "cl_errors" has output its diagnostics, "cl_cparse" calls "exit" to terminate the program with an EXIT_FAILURE status.

See Also:

expl c internal parser
for an overview of the parser routines.
expl c internal parser macros
for macros used in creating an Options Table.
expl c internal parser cl_errors
to determine if "cl_cparse" found any errors.
expl c internal parser cl_parse
for the basic routine that parses a command line.
expl c internal parser cl_ceparse
for a routine that is like "cl_cparse" but also handles environment variables.

Copyright © 1996, Thinkage Ltd.