4 * Created on: Oct 20, 2010
11 #include "../src/config.h"
13 #define CONF_FILENAME "dev_cfg_txt"
14 #define SECTION_TYPE "mysection_type"
15 #define SECTION_TYPE2 "mysection_type2"
16 #define SECTION_NAME "mysection_name"
17 #define SECTION_NAME2 "mysection_name2"
19 #define KEY_NAME "key_name"
20 #define KEY_NAME2 "key_name2"
21 #define KEY_NAME3 "key_name3"
22 #define KEY_NAME_INVALID_READ "key_name_invalid"
30 char work_dir[FILENAME_MAX];
33 getcwd(work_dir, sizeof(work_dir));
34 printf("working directory: %s\n", work_dir);
36 set_config_value_and_save(work_dir,
42 val = get_config_value_and_close(work_dir,
47 (strcmp(val, VALUE1) == 0)) {
48 printf("value 1 read ok: %s\n", val);
52 printf("failed to read value\n");
56 val = get_config_value_and_close(work_dir,
59 KEY_NAME_INVALID_READ);
61 (strcmp(val, VALUE1) == 0)) {
62 printf("pl, should not be possible to read invalid key value.\n");
66 printf("error, value was supposed to be NULL, but is: %s\n", val);
68 set_config_value_and_save(work_dir,
74 set_config_value_and_save(work_dir,
80 set_config_value_and_save(work_dir,
89 int main(int argc, char** argv) {