From: Jonathan McDowell Date: Wed, 6 Apr 2011 02:08:12 +0000 (-0700) Subject: Add help text for keyd X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/commitdiff_plain/28d25177e72f84408c99072fbe6cf05b4fc556fb?ds=inline Add help text for keyd Support -h option for printing help text. --- diff --git a/keyd.c b/keyd.c index ebf142c..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" @@ -378,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; @@ -387,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); @@ -395,6 +409,10 @@ int main(int argc, char *argv[]) case 'f': foreground = true; break; + case 'h': + default: + usage(); + break; } }