pki: Add support to encode public keys in SSH key format
[strongswan.git] / src / pki / command.c
index ebf2c56..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)
                        {
@@ -176,6 +176,13 @@ int command_usage(char *error)
                fprintf(out, "Error: %s\n", error);
        }
        fprintf(out, "strongSwan %s PKI tool\n", VERSION);
+
+       if (active == help_idx)
+       {
+               fprintf(out, "loaded plugins: %s\n",
+                               lib->plugins->loaded_plugins(lib->plugins));
+       }
+
        fprintf(out, "usage:\n");
        if (active == help_idx)
        {
@@ -201,7 +208,7 @@ int command_usage(char *error)
                }
                for (i = 0; cmds[active].options[i].name; i++)
                {
-                       fprintf(out, "        --%-12s (-%c)  %s\n",
+                       fprintf(out, "        --%-15s (-%c)  %s\n",
                                        cmds[active].options[i].name, cmds[active].options[i].op,
                                        cmds[active].options[i].desc);
                }
@@ -251,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);
 }