#include <mailutils/libargp.h>
void mu_app_init(struct argp *myargp, const char **capa, struct mu_cfg_param param,int argc, char **argv, int flags, int *pindex, void *data);
void mu_argp_init(const char *vers, const char *bugaddr);
enum mu_cfg_param_data_type
{
mu_cfg_string,
mu_cfg_short,
mu_cfg_ushort,
mu_cfg_int,
mu_cfg_uint,
mu_cfg_long,
mu_cfg_ulong,
mu_cfg_size,
mu_cfg_off,
mu_cfg_time,
mu_cfg_bool,
mu_cfg_ipv4,
mu_cfg_cidr,
mu_cfg_host,
mu_cfg_callback,
mu_cfg_section
}
struct mu_cfg_param {
const char *ident;
enum mu_cfg_param_data_type type;
void *data;
size_t offset;
mu_cfg_callback callback;
const char *docstring;
const char* argname;
}
The mu_cfg_param struct defines entries in the configuration file.
ident: option name.
type: data type. Arrays of values are specified by using the MU_CFG_LIST_OF(x) macro. The returned array is stored in a
list.
data: pointer to where the option value is stored.
offset: ?
callback: callback function.
docstring: help string.
argname: value name, used when generating help information.
void mu_app_init(struct argp *myargp, const char **capa, struct mu_cfg_param param,int argc, char **argv, int flags, int *pindex, void *data);
Processes the command line arguments and configuration file options. Command line arguments are parsed using the GNU Argp parsing routines (http://www.gnu.org/s/libc/manual/html_node/Argp.html)
myargp: the argp parser structure required by the Argp routines.
capa: this is a NULL terminated array of strings which enable the standard options. This array must be provided and should have at least one entry other than common and license.
param: This is a NULL terminated array of mu_cfg_param structures which define the configuration file options which are specific to the application.
argc: the length of the argv array.
argv: array containing the command line arguments.
flags: this is passed as the flags parameter of the argp_parse routine
pindex: returns the index in the argv array of the first unparsed option
data: this is passed as the input parameter of the argp_parse routine
Returns: 0 if the processing completes without error, non-zero if there is an error.
The strings that can be passed as part of the capa array are as follows:
address: options used by programs that do address mapping.
auth: authorisation options
common: options that are common to all utilities, mostly configuration file options.
debug: options used to control the debugging settings.
gsasl: gsasl configuration options.
license: prints the license information and exits. The standard license text can be overridden by changing the value of the mu_license_text global variable.
locking: options used by programs that access mailboxes.
logging: options used to configure the information logged via syslog.
mailbox: options used to configure mailboxes.
mailer: options used to configure mailer's.
pam: PAM configuration options.
sieve: Sieve library options.
sql:
SQL Database configuration options.
radius: Options to configure RADIUS authorisation.
tls: Options to configure TLS authorisation.
virtdomain: Options for configuring the virtual domain authorisation.
void mu_argp_init(const char *vers, const char *bugaddr);
Initialises the program name and version string and email address for bug reports which are output as part of the command help.
If NULL is passed as either of these parameters then default values defined when the libarpg library was built are used.