libglacier/include/config.h

101 lines
2.9 KiB
C

/*
* config.h - Function declarations for libglacier
*
* This file is part of Glacier.
*
* Glacier is free software: you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* Glacier is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with Glacier. If
* not, see <https://www.gnu.org/licenses/>.
*/
#ifndef GLACIERCONFIG_H_
#define GLACIERCONFIG_H_
/*
* init_config
* DESCRIPTION: Init_config initializes the libconfig library, so it can read the required runtime files
* PARAMETERS:
* None. (void)
* RETURN VAUES:
* 0 on success, EXIT_FAILURE on failure
* CAVEATS:
* None.
* EXAMPLE:
* // It is best practice to check for ALL non-zero return values, rather than specific ones,
* // as init_config() returns EXIT_FAILURE
*
* if (init_config() != 0) {
* errlog("Failed to initialize libconfig");
* return(EXIT_FAILURE); // fatal error requiring termination of program execution
* }
* else {
* successlog("Initialized libconfig"); // output automatically if LG_VERBOSE = 1
* }
*/
int init_config(void);
/**************************************************************************************************************/
/*
* die_config
* DESCRPTION: Die_config destroys the loaded libconfig library.
* PARAMETERS:
* None. (void)
* RETURN VALUES:
* EXIT_SUCCESS on success
* CAVEATS:
* None.
* EXAMPLE:
* // die_config() is unlikely to fail unless you tried to destroy an invalid object,
* // so checking for non-zero return values is unnecessary
*
* die_config();
*/
int die_config(void);
/**************************************************************************************************************/
/*
* load_all_from_config
* DESCRIPTION: Initialize all settings from glacier.cfg.
* PARAMETERS:
* None. (void)
* RETURN VALUES:
* 0 on success, 1 on file does not exist, 2 on library error
* CAVEATS:
* None.
* EXAMPLE:
* load_all_from_config();
*/
int load_all_from_config();
/**************************************************************************************************************/
/*
* [[[ DEPRECATED ]]]
* load_setting_from_config
* DESCRIPTION: Initialize a specified from glacier.cfg.
* PARAMETERS:
* char SETTING[] -> The setting to initialize
* RETURN VALUES:
* 0 on success, 1 on setting not found, 2 on file does not exist, 3 on library error
* CAVEATS:
* None.
* EXAMPLE:
* load_setting_from_config();
*/
/* int load_setting_from_config(char SETTING[]); */
#endif