diff options
author | Christian Pointner <equinox@helsinki.at> | 2009-11-04 04:19:53 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2009-11-04 04:19:53 (GMT) |
commit | 14e460a9bcaadaa2dd206a5c701814cd5e1d4648 (patch) | |
tree | 7e69c25c510765b143a02985d505e5f011ba5a68 | |
parent | 300483ff8651af328adeb83834dac0dc3442407d (diff) |
improved key value storage print
-rw-r--r-- | key_value_storage.c | 4 | ||||
-rw-r--r-- | key_value_storage.h | 2 | ||||
-rw-r--r-- | options.c | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/key_value_storage.c b/key_value_storage.c index 8ed21dd..7f4b584 100644 --- a/key_value_storage.c +++ b/key_value_storage.c @@ -76,7 +76,7 @@ char* key_value_storage_find(key_value_storage_t* stor, const char* key) return NULL; } -void key_value_storage_print(key_value_storage_t* stor) +void key_value_storage_print(key_value_storage_t* stor, const char* head, const char* sep, const char* tail) { if(!stor) return; @@ -84,7 +84,7 @@ void key_value_storage_print(key_value_storage_t* stor) string_list_element_t* k = stor->keys_.first_; string_list_element_t* v = stor->values_.first_; while(v && k) { - printf("'%s' -> '%s'\n", k->string_, v->string_); + printf("%s%s%s%s%s", head, k->string_, sep, v->string_, tail); k = k->next_; v = v->next_; } diff --git a/key_value_storage.h b/key_value_storage.h index b62a1d5..0fc4e00 100644 --- a/key_value_storage.h +++ b/key_value_storage.h @@ -35,7 +35,7 @@ void key_value_storage_clear(key_value_storage_t* stor); int key_value_storage_add(key_value_storage_t* stor, const char* key, const char* value); char* key_value_storage_find(key_value_storage_t* stor, const char* key); -void key_value_storage_print(key_value_storage_t* stor); +void key_value_storage_print(key_value_storage_t* stor, const char* head, const char* sep, const char* tail); #endif @@ -295,5 +295,6 @@ void options_print(options_t* opt) printf("conf_file: '%s'\n", opt->conf_file_); printf("command_sock: '%s'\n", opt->command_sock_); printf("switch_dev: '%s'\n", opt->switch_dev_); - key_value_storage_print(&opt->alias_table_); + printf("alias_table: \n"); + key_value_storage_print(&opt->alias_table_, " '", "' -> '", "'\n"); } |