]> the.earth.li Git - onak.git/blobdiff - keydctl.c
Change SHA_DIGEST_LENGTH to SHA1_DIGEST_SIZE to match nettle
[onak.git] / keydctl.c
index c66ce28794173515aaceef42fec5c10804108916..4ffecae2943a3fa2bcb51ba08a4889aa0c8208dc 100644 (file)
--- a/keydctl.c
+++ b/keydctl.c
@@ -2,6 +2,19 @@
  * keydctl.c - A simple program to control a running keyd instance
  *
  * Copyright 2011 Jonathan McDowell <noodles@earth.li>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #include <errno.h>
@@ -151,13 +164,16 @@ static void keyd_status(void)
        printf("Command statistics:\n");
        printf("  Version:          %d\n",
                stats.command_stats[KEYD_CMD_VERSION]);
-       printf("  Get key:          %d\n", stats.command_stats[KEYD_CMD_GET]);
+       printf("  Get key by ID:    %d\n",
+               stats.command_stats[KEYD_CMD_GET_ID]);
+       printf("  Get key by FP:    %d\n",
+               stats.command_stats[KEYD_CMD_GET_FP]);
        printf("  Store key:        %d\n",
                stats.command_stats[KEYD_CMD_STORE]);
        printf("  Delete key:       %d\n",
                stats.command_stats[KEYD_CMD_DELETE]);
        printf("  Search key:       %d\n",
-               stats.command_stats[KEYD_CMD_GETTEXT]);
+               stats.command_stats[KEYD_CMD_GET_TEXT]);
        printf("  Get full keyid:   %d\n",
                stats.command_stats[KEYD_CMD_GETFULLKEYID]);
        printf("  Iterate all keys: %d\n",
@@ -177,7 +193,7 @@ static void usage(void)
 {
        puts("keydctl " ONAK_VERSION " - control an onak keyd instance.\n");
        puts("Usage:\n");
-       puts("\tonak [options] <command> <parameters>\n");
+       puts("\tkeydctl [options] <command> <parameters>\n");
        puts("\tCommands:\n");
        puts("\tcheck    - check if keyd is running");
        puts("\tquit     - request that keyd cleanly shuts down");
@@ -207,6 +223,7 @@ int main(int argc, char *argv[])
        configfile = NULL;
 
        if ((argc - optind) < 1) {
+               cleanupconfig();
                usage();
        } else if (!strcmp("check", argv[optind])) {
                /* Just do the connect and close quietly */
@@ -222,9 +239,11 @@ int main(int argc, char *argv[])
                keyd_do_command(KEYD_CMD_QUIT, NULL, 0);
                keyd_close();
        } else {
+               cleanupconfig();
                usage();
        }
 
+       cleanupconfig();
 
        exit(EXIT_SUCCESS);
 }