% limb manual
% parseopt.h(0)
% limb 0.1.0
% 2023-07-24
# NAME
parseopt.h - parse command-line options
# SYNOPSIS
#include <limb/parseopt.h>
# DESCRIPTION
This header defines functions to parse command-line options.
## Constants
The following constants are defined :
: *ARG_NONE*, *ARG_REQ*, *ARG_OPT*
:: To define if an options has no argument, requires one, or may have one.
: *OPTION_ARG_NONE*, *OPTION_ARG_OPT*, *OPTION_ARG_REQ*
:: To define an option taking no argument, an optional argument, or a required
:: argument respectively.
: *OPTION_DONE*
:: To be used as last element in the array of *struct option*, indicating the
:: end of said array.
: *OPTID_FIRST*
:: First ID to be used for options.
: *OPTID_SHORTOPT*
:: Special ID for an option, meaning to return its `shortopt` instead.
: *PARSEOPT_STRICT*, *PARSEOPT_SILENT*
:: Flags that can be passed to [parseopt](3).
## Structures
The following structure are defined :
: *struct option*
:: To define an option when calling [parseopt](3).
: *struct parseopt*
:: An opaque structure to be passed to [parseopt](3)
## Macros
The following macros are defined :
: *PARSEOPT_ZERO*
:: Value to initialize a *struct parseopt*.
: *PO_ARG(`ctx`)*
:: To get a pointer to the current option's argument.
: *PO_CUR(`ctx`)*
:: To get the index of the first argument in argv.
: *PO_IDX(`ctx`)*
:: To get the index of the current option.
## Functions
The following functions are defined :
: [parseopt](3)
:: To parse command-line options