#include "libut/ut.h" int UT_init( int opt1, ..., INIT_END);
This function initializes the libut library. This function must be called prior to any other libut function.
A variable number of arguments are accepted, each of which specifies an option, the last (or only) of which must be INIT_END.
These are the options, some of which require parameters:
UT_init( INIT_SIGNALS(SIGHUP, SIGTERM), INIT_END );
The signal names are defined in <signal.h>.
The application can subsequently call UT_signal_reg(3)
to request
notification of the receipt of any of these signals.
Some signals cannot be caught, e.g. SIGKILL. Please consult other documentation
such as the signal(2)
manual page for further information.
These command-line flags are recognized (all others are ignored):
The return value is always 0. If an invalid option is encountered, it is logged and the application exits with exit status -1.
Options are scanned in the order they appear (left-to-right). I.e., later options override earlier ones, in the case of repetition. This is useful when INIT_ARGCV is used. I.e., defaults can be set early in the option list, followed by INIT_ARGCV (allowing user-specified command-line options to override the previous options). If other options follow INIT_ARGCV, they override any options the user specified on the command-line.
UT_init( INIT_LOGFILE, "/var/server.log", INIT_DETACH, INIT_END);
UT_init( INIT_SHL_IPPORT, "127.0.0.1:5555", INIT_ARGCV, argc, argv, INIT_END );
Troy D. Hanson <thanson@users.sourceforge.net>