pki: Add support to encode public keys in SSH key format
[strongswan.git] / src / pki / command.c
index e74072f..984da59 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdio.h>
 
 #include <library.h>
-#include <debug.h>
+#include <utils/debug.h>
 #include <utils/optionsfrom.h>
 
 /**
@@ -144,7 +144,7 @@ void command_register(command_t command)
        /* append default options, but not to --help */
        if (!active)
        {
-               for (i = 0; i < countof(cmds[registered].options); i++)
+               for (i = 0; i < countof(cmds[registered].options) - 1; i++)
                {
                        if (cmds[registered].options[i].name)
                        {
@@ -179,9 +179,8 @@ int command_usage(char *error)
 
        if (active == help_idx)
        {
-               char *plugins = lib->plugins->loaded_plugins(lib->plugins);
-               fprintf(out, "loaded plugins: %s\n", plugins);
-               free(plugins);
+               fprintf(out, "loaded plugins: %s\n",
+                               lib->plugins->loaded_plugins(lib->plugins));
        }
 
        fprintf(out, "usage:\n");
@@ -259,6 +258,6 @@ int command_dispatch(int c, char *v[])
                        return cmds[i].call();
                }
        }
-       return command_usage("invalid operation");
+       return command_usage(c > 1 ? "invalid operation" : NULL);
 }