X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=conf.c;h=889bda6e4327839927c022626a816a186b61274b;hb=bafa6f74e4a8112b650cb1aa2894bc5c0184fca5;hp=9d8dff9d541f2417dc0154f4f0d51ca4050380bb;hpb=7e8ce091da421353576edbd2a4a4e620fe0a62bd;p=wmpus diff --git a/conf.c b/conf.c index 9d8dff9..889bda6 100644 --- a/conf.c +++ b/conf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Andy Spencer + * Copyright (c) 2011-2012, Andy Spencer * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -23,10 +23,11 @@ #include "conf.h" /* Types */ -typedef enum { NUMBER, STRING } type_t; - typedef struct { - type_t type; + enum { + NUMBER, + STRING, + } type; char *key; union { int num; @@ -74,11 +75,11 @@ static void conf_set(const char *key, int num, const char *str) if (str) { entry->type = STRING; entry->str = strdup(str); - printf("set_str: %s = %s\n", key, str); + //printf("set_str: %s = %s\n", key, str); } else { entry->type = NUMBER; entry->num = num; - printf("set_num: %s = %d\n", key, num); + //printf("set_num: %s = %d\n", key, num); } tsearch(entry, &conf, conf_cmp); } @@ -103,7 +104,7 @@ static void load_file(const char *path) char key[256]={}, val[256]={}, fullkey[256]={}; FILE *fd = fopen(path, "rt"); if (!fd) return; - printf("load_file: %s\n", path); + //printf("load_file: %s\n", path); while (fgets(line, sizeof(line), fd)) { /* Find special characters */ char *lbrace = strchr( line , '['); @@ -127,7 +128,7 @@ static void load_file(const char *path) section, strtrim(key)); if (!strchr(fullkey, ' ')) { conf_set_str(fullkey, val); - printf(" [%s] = [%s]\n", fullkey, val); + //printf(" [%s] = [%s]\n", fullkey, val); } } else if (section[0] && equal) { @@ -147,7 +148,7 @@ static void load_file(const char *path) conf_set_int(fullkey, 0); else conf_set_str(fullkey, trim); - printf(" [%s] = [%s]\n", fullkey, trim); + //printf(" [%s] = [%s]\n", fullkey, trim); } } }