limb 0.2.0

2024-01-09

loadopt_auto_noconfig(3)
limb manual
loadopt_auto_noconfig(3)

NAME

loadopt_auto_noconfig - automatic handling of the "noconfig" option

SYNOPSIS

#include <limb/autoopt.h>
AUTOOPT_NOCONFIG(shortopt, longopt, flags, id)

int loadopt_auto_noconfig(int idx, const struct option *options, struct loadopt *ctx)

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).

limb 0.1.0
2023-07-24
loadopt_auto_noconfig(3)