diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-01-19 11:53:06 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-01-19 11:56:03 +0100 |
commit | 576298a3ef07bba9999dfe167aba46d527e2cbfe (patch) | |
tree | 96bf1974b0b1ed6e7d501811ad14ca5ebe9b3ea2 /src | |
parent | ad1aaf4be37e70f29421df1c1a288b0c40756641 (diff) | |
download | strongswan-576298a3ef07bba9999dfe167aba46d527e2cbfe.tar.bz2 strongswan-576298a3ef07bba9999dfe167aba46d527e2cbfe.tar.xz |
Simplified logging of list of loaded plugins.
Diffstat (limited to 'src')
-rw-r--r-- | src/libcharon/daemon.c | 19 | ||||
-rw-r--r-- | src/libcharon/plugins/stroke/stroke_list.c | 13 | ||||
-rw-r--r-- | src/pluto/log.c | 16 | ||||
-rw-r--r-- | src/pluto/plutomain.c | 18 | ||||
-rw-r--r-- | src/scepclient/scepclient.c | 15 |
5 files changed, 22 insertions, 59 deletions
diff --git a/src/libcharon/daemon.c b/src/libcharon/daemon.c index 5b79aa303..f175826d5 100644 --- a/src/libcharon/daemon.c +++ b/src/libcharon/daemon.c @@ -206,20 +206,11 @@ METHOD(daemon_t, start, void, */ static void print_plugins() { - char buf[512]; - int len = 0; - enumerator_t *enumerator; - plugin_t *plugin; - - buf[0] = '\0'; - enumerator = lib->plugins->create_plugin_enumerator(lib->plugins); - while (len < sizeof(buf) && enumerator->enumerate(enumerator, &plugin, NULL)) - { - len += snprintf(&buf[len], sizeof(buf)-len, "%s ", - plugin->get_name(plugin)); - } - enumerator->destroy(enumerator); - DBG1(DBG_DMN, "loaded plugins: %s", buf); + char *plugins; + + plugins = lib->plugins->loaded_plugins(lib->plugins); + DBG1(DBG_DMN, "loaded plugins: %s", plugins); + free(plugins); } METHOD(daemon_t, initialize, bool, diff --git a/src/libcharon/plugins/stroke/stroke_list.c b/src/libcharon/plugins/stroke/stroke_list.c index af061155f..8125d37bf 100644 --- a/src/libcharon/plugins/stroke/stroke_list.c +++ b/src/libcharon/plugins/stroke/stroke_list.c @@ -415,7 +415,7 @@ METHOD(stroke_list_t, status, void, { peer_cfg_t *peer_cfg; plugin_t *plugin; - char *pool; + char *pool, *plugins; host_t *host; u_int32_t dpd; time_t since, now; @@ -449,14 +449,9 @@ METHOD(stroke_list_t, status, void, } fprintf(out, ", scheduled: %d\n", lib->scheduler->get_job_load(lib->scheduler)); - fprintf(out, " loaded plugins: "); - enumerator = lib->plugins->create_plugin_enumerator(lib->plugins); - while (enumerator->enumerate(enumerator, &plugin, NULL)) - { - fprintf(out, "%s ", plugin->get_name(plugin)); - } - enumerator->destroy(enumerator); - fprintf(out, "\n"); + plugins = lib->plugins->loaded_plugins(lib->plugins); + fprintf(out, " loaded plugins: %s\n", plugins); + free(plugins); first = TRUE; enumerator = this->attribute->create_pool_enumerator(this->attribute); diff --git a/src/pluto/log.c b/src/pluto/log.c index 0bfc8fa9e..91bc57e1a 100644 --- a/src/pluto/log.c +++ b/src/pluto/log.c @@ -868,19 +868,11 @@ DBG_dump(const char *label, const void *p, size_t len) static void show_loaded_plugins() { - char buf[BUF_LEN]; - plugin_t *plugin; - int len = 0; - enumerator_t *enumerator; + char *plugins; - buf[0] = '\0'; - enumerator = lib->plugins->create_plugin_enumerator(lib->plugins); - while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin, NULL)) - { - len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin)); - } - enumerator->destroy(enumerator); - whack_log(RC_COMMENT, "loaded plugins: %s", buf); + plugins = lib->plugins->loaded_plugins(lib->plugins); + whack_log(RC_COMMENT, "loaded plugins: %s", plugins); + free(plugins); } void show_status(bool all, const char *name) diff --git a/src/pluto/plutomain.c b/src/pluto/plutomain.c index 0f2844813..904ed82c1 100644 --- a/src/pluto/plutomain.c +++ b/src/pluto/plutomain.c @@ -269,19 +269,11 @@ options_t *options; */ static void print_plugins() { - char buf[BUF_LEN]; - plugin_t *plugin; - int len = 0; - enumerator_t *enumerator; - - buf[0] = '\0'; - enumerator = lib->plugins->create_plugin_enumerator(lib->plugins); - while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin, NULL)) - { - len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin)); - } - enumerator->destroy(enumerator); - DBG1(DBG_DMN, "loaded plugins: %s", buf); + char *plugins; + + plugins = lib->plugins->loaded_plugins(lib->plugins); + DBG1(DBG_DMN, "loaded plugins: %s", plugins); + free(plugins); } int main(int argc, char **argv) diff --git a/src/scepclient/scepclient.c b/src/scepclient/scepclient.c index b7f074f02..efe13c264 100644 --- a/src/scepclient/scepclient.c +++ b/src/scepclient/scepclient.c @@ -280,18 +280,11 @@ usage(const char *message) */ static void print_plugins() { - char buf[BUF_LEN]; - plugin_t *plugin; - int len = 0; - enumerator_t *enumerator; + char *plugins; - enumerator = lib->plugins->create_plugin_enumerator(lib->plugins); - while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin, NULL)) - { - len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin->get_name(plugin)); - } - enumerator->destroy(enumerator); - DBG1(DBG_LIB, " loaded plugins: %s", buf); + plugins = lib->plugins->loaded_plugins(lib->plugins); + DBG1(DBG_LIB, " loaded plugins: %s", plugins); + free(plugins); } /** |