Crinit -- Configurable Rootfs Init
|
Implementation of the Config Parser. More...
#include "confparse.h"
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "confconv.h"
#include "confmap.h"
#include "elosio.h"
#include "envset.h"
#include "globopt.h"
#include "ini.h"
#include "ioredir.h"
#include "lexers.h"
#include "logio.h"
Classes | |
struct | crinitIniParserCtx_t |
Functions | |
static int | crinitIniHandler (void *parserCtx, const char *section, const char *name, const char *value) |
int | crinitParseConf (crinitConfKvList_t **confList, const char *filename) |
void | crinitFreeConfList (crinitConfKvList_t *confList) |
void | crinitFreeArgvArray (char **inArgv) |
static int | crinitConfSanityCheck (void) |
int | crinitLoadSeriesConf (crinitFileSeries_t *series, const char *filename) |
Implementation of the Config Parser.
|
static |
void crinitFreeArgvArray | ( | char ** | inArgv | ) |
Frees a string array with a backing string.
inArgv | The string array to free, must be a double pointer with 2 allocations, one array of pointers and a single inner array of char. |
void crinitFreeConfList | ( | crinitConfKvList_t * | confList | ) |
Frees memory allocated for an crinitConfKvList_t by crinitParseConf().
confList | Pointer to crinitConfKvList_t allocated by crinitParseConf() and not freed before. If confList is NULL, crinitFreeConfList() will return without freeing any memory. |
|
static |
Parser handler for libinih.
int crinitLoadSeriesConf | ( | crinitFileSeries_t * | series, |
const char * | filename | ||
) |
Parse a series file.
Will return the task config and include files to be loaded in series. Will also set any global options specified in the series file.
series | Returns the paths to the task configs specified in the series file (or scanned from TASKDIR, if configured). |
filename | The path to the series file to load. |
int crinitParseConf | ( | crinitConfKvList_t ** | confList, |
const char * | filename | ||
) |
Parse a config file into a crinitConfKvList_t.
Parses a config file and fills confList. Items of confList are dynamically allocated (grown) and need to be freed using free_confList(). The format of the config file is expected to be KEY1=VALUE1<newline>KEY2=VALUE2<newline>... Lines beginning with '#' are considered comments.
confList | will return a pointer to dynamically allocated memory of a ConfKvList filled with the key/value-pairs from the config file. |
filename | Path to the configuration file. |