diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2018-04-15 00:43:08 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2018-04-15 00:43:08 +0300 |
commit | bc25e14b448edb9f41260a23cf6567e6632db267 (patch) | |
tree | 71362a1c8d369f3d0080baee5f98edb3439f3735 /src/confparser.h | |
parent | 0168c10023f0040ae2fa31a212eb6d2e411eefb3 (diff) | |
download | ck-bc25e14b448edb9f41260a23cf6567e6632db267.tar.gz ck-bc25e14b448edb9f41260a23cf6567e6632db267.tar.bz2 ck-bc25e14b448edb9f41260a23cf6567e6632db267.zip |
dummy init done
action parser
conf parser
db layer
Diffstat (limited to 'src/confparser.h')
-rw-r--r-- | src/confparser.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/confparser.h b/src/confparser.h new file mode 100644 index 0000000..2ed8f82 --- /dev/null +++ b/src/confparser.h @@ -0,0 +1,45 @@ +/* confparser.h - Configuration file parser for ck -------------*- C -*- + * + * This file is part of ck, the config keeper + * + * --------------------------------------------------------------------- + * The code here and in confparser.c is responsible parsing + * the configuration and get the values set there + * ------------------------------------------------------------------ */ +#ifndef CONFPARSER_H +#define CONFPARSER_H +#define CONFIG_VARIABLES_TABLE \ + X(VC_dir, " version_control_dir = %s ", "Version Control directory") \ + X(SCRT_dir, " secret_dir = %s " , "Secret directory") + + +typedef enum ConfingVariables ConfVar; +#define X(var, str, name) CV_##var, +enum ConfingVariables { + CV_NO_VAL_OR_COMMENT, + CONFIG_VARIABLES_TABLE +}; +#undef X + +typedef enum ConfigParserResults ConfigParserResult; +#define X(var, str, name) \ + CPR_WRONG_##var, +enum ConfigParserResults { + CPR_OK, + CPR_NO_CONFIG_FILE, + CPR_WRONG_CONFIG, + CONFIG_VARIABLES_TABLE +}; +#undef X + +typedef struct ConfigValues Conf; +#define X(var, str, name) char* var; +struct ConfigValues { + ConfigParserResult result; + CONFIG_VARIABLES_TABLE +}; +#undef X + +extern int config_file_parse(Conf *conf); + +#endif // CONFPARSER_H |