2.12 Option Parsing Errors

mu_parse_opts and mu_parse_subopts can fail for several reasons. On failure, these functions will return an error code depending on the reason for failure. The error code can be one of the following:

Constant: MU_OPT_ERR_PARSE

An option parsing error. This indicates that the user made an error when specifying options on the command line. You may wish to print a help message when mu_parse_opts returns this value (see Formatting Help for an example).

Constant: MU_OPT_ERR_IO

This indicates that an input/output error occurred while parsing the arguments. This could indicate, for example, failure to open a file specified as an argument to an option which has a arg_type field of MU_OPT_FILE (see Option Structure).

Constant: MU_OPT_ERR_CALLBACK

This value is returned from mu_parse_opts when a callback returns a nonzero value (see Option Callbacks). You can have your callback set an error flag if you want more details.

Macro: int MU_OPT_ERR (int retval)

This macro returns true if retval is one of the above error codes.