CL_ARGN - get original argument from parsed command line.

Usage:

#include <cl.h>
loc = cl_argn(cl,index);             /* MACRO */
locptr = cl_argN(cl,index);          /* MACRO */

Where:

CL_PARSED *cl;
points to a parsed command line structure, as returned by "cl_cparse" or a related routine.
int index;
tells the table entry whose original value you want to obtain.
int loc;
is an index into an "argv" list indicating the position of the original argument.
int *locptr;
points to a vector of integers, each giving the "argv" index of the parameter in the matching vector returned by "cl_argv", "cl_numv", or "cl_realv".

Description:

The "cl_argn" and "cl_argN" macros both obtain original argument values as specified on the command line. The two are used for different types of options.

For example, consider the following input command line

comm =opt arg =mopt arg1 arg2 arg3 ==
  0    1   2    3    4    5    6   7

The numbers under the command line show how each argument is numbered. Let's assume that OPT is a symbolic constant indicating the Options Table index of the "=opt" option, and MOPT indicates the index of the "=mopt" option. Then

cl_argn(cl,OPT)

returns the value 1 because that's the "argv" position of the "=opt" keyword. (Note that this is the position of the keyword, not the associated value.)

cl_argN(cl,MOPT)

returns a pointer to a vector containing the numbers

4 5 6

since those are the "argv" positions of three argument values for the "=mopt" option.

cl_argv(cl,MOPT)

returns a pointer to a list of the actual values of the argument strings

"arg1"  "arg2"  "arg3"

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.

Copyright © 1996, Thinkage Ltd.