Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
|
Init/done and persistence.
Init/Done ... | |
void | EnvInit (int argc, char **argv, const char *specOptionsUsage=NULL, const char *instanceName=NULL, bool noBanner=false) |
Initialize the environment module. More... | |
void | EnvPrintBanner () |
Print the tool banner (only useful if banner was suppressed in the EnvInit() call). | |
void | EnvDone () |
Shutdown the environment module. | |
Persistence ... | |
void | EnvEnablePersistence (bool writeThrough=true, const char *_varFileName=NULL) |
Enable the persistence of all environment variables starting with "var.*". More... | |
void | EnvFlush () |
Write back any persistent variables now. | |
void EnvInit | ( | int | argc, |
char ** | argv, | ||
const char * | specOptionsUsage = NULL , |
||
const char * | instanceName = NULL , |
||
bool | noBanner = false |
||
) |
Initialize the environment module.
argc | is the main funcion's 'argc' parameter. |
argv | is the main funcion's 'argv' parameter. |
specOptionsUsage | allows to add extra usage information on specific tool options. |
instanceName | defines the instance name, which otherwise is derived from the executable name (argv[0]). |
noBanner | suppresses the output of the tool banner (for command line tools with minimal output). |
void EnvEnablePersistence | ( | bool | writeThrough = true , |
const char * | _varFileName = NULL |
||
) |
Enable the persistence of all environment variables starting with "var.*".
writeThrough | decides whether the file is written back automatically with each EnvPut() call changing any "var.*" variable. If set to 'false', the file is only written back on shutdown ( EnvDone() ) or on a explicit flush ( EnvFlush() ). |
_varFileName | is the filename to store the variables, which should be pathname relative to the "var" directory. By default, "home2l-<instance name>.conf" is used. It is discouraged to pass an absolute path there. |
Persistent variables are (tried to be) read from the filesystem on this call, and they may override any settings in the main configuration file.
This function may be called multiple times, for example, on tool initialization and then later again inside RcInit(), if the user has declared persistent resources. On the second invocation, '_varFileName' must be NULL. If 'writeThrough' is set differently, a logical OR of all passed values will become effective.