25            char *conf_str = malloc(size + 1);
 
   26            memset(conf_str, 0, size + 1);
 
   31            conf = fopen(path, 
"r");
 
   34                char *read_ptr    = conf_str;
 
   35                size_t read_bytes = 0;
 
   36                while ( (read_bytes = fread(conf_str, 1, size, conf) ) ) {
 
   37                    read_ptr += read_bytes;
 
 
   49void conf_set(
const char *path, 
const char *conf_str)
 
   53            setenv(
"ARAX_CONF", conf_str, 1);
 
   59            size_t size = strlen(conf_str);
 
   60            conf = fopen(path, 
"w");
 
   62                fwrite(conf_str, 1, size, conf);
 
 
   74    char *next       = malloc(strlen(prev) + strlen(key) + strlen(value) + 3);
 
   78    sprintf(next + strlen(next), 
"%s %s\n", key, value);
 
 
   89    sprintf(svalue, 
"%ld", value);
 
 
   96    char temp[4096] = { 0 };
 
   98    size_t size     = 
sizeof(temp);
 
  110                size_t home_len  = strlen(home);
 
  112                strncat(tp, home, size);
 
  123    tp = malloc(strlen(temp) + 1);
 
 
  136    const char *cleanup = conf;
 
  146        if (sscanf(conf, 
"%127s %895s%n", ckey, cval, &len) < 2) {
 
  151        if (!strncmp(ckey, key, 
sizeof(ckey) ) ) {
 
  153            strncpy(value, cval, value_size);
 
  159    free((
void *) cleanup);
 
 
  169            strncpy(value, def_val, value_size);
 
  171            fprintf(stderr, 
"No default value for \'%s\' config key\n", key);
 
 
  181        if (*value == 0 || *value == 1)
 
 
  195        if (INT_MAX >= cval && INT_MIN <= cval) {
 
 
  214        *value = strtol(cval, &end, 0);
 
  215        if (errno || end == cval) {
 
 
  231        if (SIZE_MAX >= cval && 0 <= cval) {
 
 
#define arax_assert(EXPR)
int _utils_config_get_str(char *path, const char *key, char *value, size_t value_size)
enum utils_config_source utils_config_get_source()
int utils_config_get_long(char *path, const char *key, long *value, long def_val)
int utils_config_get_str(char *path, const char *key, char *value, size_t value_size, const char *def_val)
int utils_config_get_int(char *path, const char *key, int *value, int def_val)
int utils_config_get_size(char *path, const char *key, size_t *value, size_t def_val)
void utils_config_write_str(char *path, const char *key, const char *value)
void utils_config_free_path(char *path)
void utils_config_write_long(char *path, const char *key, long value)
const char * conf_get(const char *path)
int utils_config_get_bool(char *path, const char *key, int *value, int def_val)
void conf_set(const char *path, const char *conf_str)
char * utils_config_alloc_path(const char *path)
char * system_home_path()
off_t system_file_size(const char *file)
const char * system_env_var(const char *var)