--- embedaddon/iftop/cfgfile.c 2012/02/21 16:57:34 1.1.1.1 +++ embedaddon/iftop/cfgfile.c 2016/10/18 14:04:50 1.1.1.2 @@ -8,6 +8,7 @@ #include #include #include +#include #include "stringmap.h" #include "iftop.h" @@ -36,7 +37,12 @@ char * config_directives[] = { "log-scale", "max-bandwidth", "net-filter", + "net-filter6", + "link-local", "port-display", + "timed-output", + "no-curses", + "num-lines", NULL }; @@ -45,9 +51,9 @@ stringmap config; extern options_t options ; int is_cfgdirective_valid(const char *s) { - char **t; - for (t = config_directives; *t != NULL; ++t) - if (strcmp(s, *t) == 0) return 1; + int t; + for (t = 0; config_directives[t] != NULL; t++) + if (strcmp(s, config_directives[t]) == 0) return 1; return 0; } @@ -164,7 +170,6 @@ int config_get_int(const char *directive, int *value) * failure, or 0 if no value was found. */ int config_get_float(const char *directive, float *value) { stringmap S; - item *I; char *s, *t; if (!value) return -1; @@ -230,12 +235,15 @@ void config_set_string(const char *directive, const ch stringmap S; S = stringmap_find(config, directive); - if (S) stringmap_delete_free(S); - stringmap_insert(config, directive, item_ptr(xstrdup(s))); + if (S) { + xfree(S->d.v); + S->d = item_ptr(xstrdup(s)); + } + else { + stringmap_insert(config, directive, item_ptr(xstrdup(s))); + } } int read_config(char *file, int whinge_on_error) { - void* o; - return read_config_file(file, whinge_on_error); }