From 14e460a9bcaadaa2dd206a5c701814cd5e1d4648 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 4 Nov 2009 04:19:53 +0000 Subject: improved key value storage print 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 diff --git a/options.c b/options.c index 66f716e..05ea50a 100644 --- a/options.c +++ b/options.c @@ -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"); } -- cgit v0.10.2