GME  13
Classes | Typedefs | Functions | Variables
Command Argument Parsing

Classes

struct  apr_getopt_t
struct  apr_getopt_option_t

Typedefs

typedef void( apr_getopt_err_fn_t )(void *arg, const char *err,...)
typedef struct apr_getopt_t apr_getopt_t
typedef struct apr_getopt_option_t apr_getopt_option_t

Functions

 APR_DECLARE (apr_status_t) apr_getopt_init(apr_getopt_t **os

Variables

apr_pool_tcont
apr_pool_t int argc
apr_pool_t int const char *const * argv
const char * opts
const char char * option_ch
const char char const char ** option_arg

Typedef Documentation

typedef void( apr_getopt_err_fn_t)(void *arg, const char *err,...)

An apr_getopt_t error callback function.

arg is this apr_getopt_t's errarg member.

Definition at line 42 of file apr_getopt.h.

See also:
apr_getopt_option_t

Definition at line 78 of file apr_getopt.h.

typedef struct apr_getopt_t apr_getopt_t
See also:
apr_getopt_t

Definition at line 45 of file apr_getopt.h.


Function Documentation

Initialize the arguments for parsing by apr_getopt().

Parameters:
osThe options structure created for apr_getopt()
contThe pool to operate on
argcThe number of arguments to parse
argvThe array of arguments to parse
Remarks:
Arguments 3 and 4 are most commonly argc and argv from main(argc, argv) The (*os)->errfn is initialized to fprintf(stderr... but may be overridden.

Parse the options initialized by apr_getopt_init().

Parameters:
osThe apr_opt_t structure returned by apr_getopt_init()
optsA string of characters that are acceptable options to the program. Characters followed by ":" are required to have an option associated
option_chThe next option character parsed
option_argThe argument following the option character:
Returns:
There are four potential status values on exit. They are:
             APR_EOF      --  No more options to parse
             APR_BADCH    --  Found a bad option character
             APR_BADARG   --  No argument followed the option flag
             APR_SUCCESS  --  The next option was found.
 

Parse the options initialized by apr_getopt_init(), accepting long options beginning with "--" in addition to single-character options beginning with "-".

Parameters:
osThe apr_getopt_t structure created by apr_getopt_init()
optsA pointer to a list of apr_getopt_option_t structures, which can be initialized with { "name", optch, has_args }. has_args is nonzero if the option requires an argument. A structure with an optch value of 0 terminates the list.
option_chReceives the value of "optch" from the apr_getopt_option_t structure corresponding to the next option matched.
option_argReceives the argument following the option, if any.
Returns:
There are four potential status values on exit. They are:
             APR_EOF      --  No more options to parse
             APR_BADCH    --  Found a bad option character
             APR_BADARG   --  No argument followed the option flag
             APR_SUCCESS  --  The next option was found.
 
When APR_SUCCESS is returned, os->ind gives the index of the first non-option argument. On error, a message will be printed to stdout unless os->err is set to 0. If os->interleave is set to nonzero, options can come after arguments, and os->argv will be permuted to leave non-option arguments at the end (the original argv is unaffected).

Variable Documentation

Definition at line 103 of file apr_getopt.h.

apr_pool_t int const char* const* argv

Definition at line 103 of file apr_getopt.h.

Definition at line 103 of file apr_getopt.h.

const apr_getopt_option_t int const char ** option_arg

Definition at line 122 of file apr_getopt.h.

Definition at line 122 of file apr_getopt.h.

Definition at line 122 of file apr_getopt.h.