Welcome to little lamb

Code » limb » release » tree

[release] / src / doc / loadopt.h / loadopt_auto_noconfig.3.md

% limb manual
% loadopt_auto_noconfig(3)
% limb 0.1.0
% 2023-07-24

# NAME

loadopt\_auto\_noconfig - automatic handling of the "noconfig" option

# SYNOPSIS

    #include <limb/autoopt.h>

```pre hl
AUTOOPT_NOCONFIG(<em>shortopt</em>, <em>longopt</em>, <em>flags</em>, <em>id</em>)

int loadopt_auto_noconfig(int <em>idx</em>, const struct option *<em>options</em>, struct loadopt *<em>ctx</em>)
```

# DESCRIPTION

The `loadopt_auto_noconfig`() function is intended to be used during parsing of
command-line options via [loadopt](3), to handle automatically a "noconfig"
option.

This option can be used on command-line to disable the loading of (specified)
default values from configuration file, and accepts an optional argument.

You can define such an option through the convenience macro *AUTOOPT_NOCONFIG*.

The `idx` argument must be the index of the option to be processed inside the
array `options`. The `ctx` argument must be a pointer to the same structure that
is being used with [loadopt](3).

If no argument was given to the option, it will disable loading options from the
configuration file altogether. Else, the argument is expected to be a
coma-separated list of option names (`longopt`) to be disabled. Partial names
are accepted only when they are unique to one option.

# RETURN VALUE

The `loadopt_auto_noconfig`() function returns 0 on success. Otherwise, it
returns -1 and sets `errno` to indicate the error. It also emits a warning
(through the [warn](3) family of functions), similar to what [loadopt](3) does.

# ERRORS

The `loadopt_auto_noconfig`() function may fail i:

: *EINVAL*
:: The argument contained at least one unknown option (or partial match to more
:: than a single option).