00001 #ifndef __CONFIG_FILE_H
00002 #define __CONFIG_FILE_H
00003
00004
00016 #define _GNU_SOURCE //For getline function in stdio.h
00017
00018 #include <stdio.h>
00019 #include <string.h>
00020 #include <stdlib.h>
00021 #include <errno.h>
00022
00023 #define CONFIG_FILE_MAX_PAIRS 64
00024 #define CONFIG_FILE_MAX_RESIZE 32
00025
00026
00027
00029 struct key_value_pair{
00030 char *key;
00031 char *value;
00032 };
00033 typedef struct key_value_pair key_value_pair_t;
00034
00035
00036
00056 key_value_pair_t *config_file_read(char *filename, int *pairs_loaded);
00057
00058
00075 int config_file_write(char *filename, key_value_pair_t *pairs,
00076 int pairs_to_write);
00077
00078
00079
00092 char *config_file_get_value(key_value_pair_t *pairs, char *key,
00093 int pairs_loaded);
00094
00111 void config_file_destroy(key_value_pair_t *pairs, int pairs_loaded);
00112
00115 #endif