Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / loadopt.h / loadopt.h.0.md

% limb manual
% loadopt.h(0)
% limb 0.1.0
% 2023-07-24

# NAME

loadopt.h - parse options from command-line & configuration file

# SYNOPSIS

    #include <limb/loadopt.h>

# DESCRIPTION

This header defines functions to parse options from command-line, and
optionally configuration file.

## Constants

The following constants are defined :

: *OPT_SKIP*, *OPT_REQ*, *OPT_SA*, *OPT_ESC*, *OPT_PATH*, *OPT_FILE*, *OPT_RPT*
:: Flags that can be used when defining options/arguments to [loadopt](3).

## Macros

The following macros are defined :

: *LOADOPT_ARGUMENTS*, *LOADOPT_DONE*, *LOADOPT_STOP*
:: To be used as element in a *struct option* array

: *LOADOPT_INIT*
:: Value to initialize a *struct loadopt*.

: *ARGUMENT_REQ*(`arg`), *ARGUMENT_OPT*(`arg`)
:: To define required or optional argument in a *struct option* array to be
:: checked by [loadopt](3)

: *AUTOOPT_NOCONFIG*(`shortopt`, `longopt`, `flags`, `id`)
:: To define the option to disable loading (specified) options from
:: configuration

: *LO_ARG*(`ctx`)
:: To get a pointer to the current option's argument.

: *LO_OFF*(`ctx`)
:: To get the offset to the current option's argument. See [loadopt](3) for
:: more.

: *LO_CUR*(`ctx`)
:: To get the index of the first argument in `argv`.

: *LO_IDX*(`ctx`)
:: To get the index of the current option.

: *LO_FROMFILE*(`ctx`)
:: Return whether or not the option was set from configuration directory.

## Structures

The following structure are defined :

: *struct loadopt*
:: An opaque structure to be passed to [loadopt](3)

## Functions

The following functions are defined :

: [loadopt](3)
:: To parse options from command-line & optionally configuration file

: [loadopt_auto_noconfig](3)
:: To parse the "noconfig" option automatically