X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=keyd.c;h=c2d83491ea91fc6e23dcd75ee57ff0a9bbef1ec9;hb=28d25177e72f84408c99072fbe6cf05b4fc556fb;hp=ccc47502f0fd0e86de306ead5a82ac927619d999;hpb=f9917d386685c7f641d493dbc78eb3eb41fb24bd;p=onak.git diff --git a/keyd.c b/keyd.c index ccc4750..c2d8349 100644 --- a/keyd.c +++ b/keyd.c @@ -19,6 +19,7 @@ #include #include +#include "config.h" #include "charfuncs.h" #include "cleanup.h" #include "keyd.h" @@ -335,6 +336,8 @@ int sock_do(int fd) case KEYD_CMD_QUIT: cmd = KEYD_REPLY_OK; write(fd, &cmd, sizeof(cmd)); + logthing(LOGTHING_NOTICE, + "Exiting due to quit request."); ret = 1; trytocleanup(); break; @@ -376,6 +379,19 @@ int sock_accept(int fd) return 1; } +static void usage(void) +{ + puts("keyd " PACKAGE_VERSION " - backend key serving daemon for the " + "onak PGP keyserver.\n"); + puts("Usage:\n"); + puts("\tkeyd [options]\n"); + puts("\tOptions:\n:"); + puts("-c - use as the config file"); + puts("-f - run in the foreground"); + puts("-h - show this help text"); + exit(EXIT_FAILURE); +} + int main(int argc, char *argv[]) { int fd = -1; @@ -385,7 +401,7 @@ int main(int argc, char *argv[]) bool foreground = false; int optchar; - while ((optchar = getopt(argc, argv, "c:f")) != -1 ) { + while ((optchar = getopt(argc, argv, "c:fh")) != -1 ) { switch (optchar) { case 'c': configfile = strdup(optarg); @@ -393,6 +409,10 @@ int main(int argc, char *argv[]) case 'f': foreground = true; break; + case 'h': + default: + usage(); + break; } }