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];
34 ret = getcwd(work_dir, sizeof(work_dir));
36 printf("working directory: %s\n", work_dir);
38 set_config_value_and_save(work_dir,
44 val = get_config_value_and_close(work_dir,
49 (strcmp(val, VALUE1) == 0)) {
50 printf("value 1 read ok: %s\n", val);
54 printf("failed to read value\n");
58 val = get_config_value_and_close(work_dir,
61 KEY_NAME_INVALID_READ);
63 (strcmp(val, VALUE1) == 0)) {
64 printf("pl, should not be possible to read invalid key value.\n");
68 printf("error, value was supposed to be NULL, but is: %s\n", val);
70 set_config_value_and_save(work_dir,
76 set_config_value_and_save(work_dir,
82 set_config_value_and_save(work_dir,
92 int main(int argc, char** argv) {