Skip to main content

apr_getopt_long

Function apr_getopt_long 

Source
pub unsafe extern "C" fn apr_getopt_long(
    os: *mut apr_getopt_t,
    opts: *const apr_getopt_option_t,
    option_ch: *mut c_int,
    option_arg: *mut *const c_char,
) -> apr_status_t
Expand description

Parse the options initialized by apr_getopt_init(), accepting long options beginning with “–” in addition to single-character options beginning with “-”. @param os The apr_getopt_t structure created by apr_getopt_init() @param opts A 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. @param option_ch Receives the value of “optch” from the apr_getopt_option_t structure corresponding to the next option matched. @param option_arg Receives the argument following the option, if any. @return 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).