From 2b92b8685727d708793756158493beb30719c875 Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Fri, 15 Oct 2010 12:43:48 +0200 Subject: Add configuration file support. --- src/config-ini.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/config-ini.h (limited to 'src/config-ini.h') diff --git a/src/config-ini.h b/src/config-ini.h new file mode 100644 index 0000000..e1bff73 --- /dev/null +++ b/src/config-ini.h @@ -0,0 +1,49 @@ +/* config-ini.h -- INI config file parser header + This file is part of Redshift. + + Redshift is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Redshift 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Redshift. If not, see . + + Copyright (c) 2010 Jon Lund Steffensen +*/ + +#ifndef _REDSHIFT_CONFIG_INI_H +#define _REDSHIFT_CONFIG_INI_H + +typedef struct _config_ini_section config_ini_section_t; +typedef struct _config_ini_setting config_ini_setting_t; + +struct _config_ini_setting { + config_ini_setting_t *next; + char *name; + char *value; +}; + +struct _config_ini_section { + config_ini_section_t *next; + char *name; + config_ini_setting_t *settings; +}; + +typedef struct { + config_ini_section_t *sections; +} config_ini_state_t; + + +int config_ini_init(config_ini_state_t *state, const char *filepath); +void config_ini_free(config_ini_state_t *state); + +config_ini_section_t *config_ini_get_section(config_ini_state_t *state, + const char *name); + +#endif /* ! _REDSHIFT_CONFIG_INI_H */ -- cgit v1.2.3-70-g09d2