From 28d25177e72f84408c99072fbe6cf05b4fc556fb Mon Sep 17 00:00:00 2001 From: Jonathan McDowell Date: Tue, 5 Apr 2011 19:08:12 -0700 Subject: [PATCH] Add help text for keyd Support -h option for printing help text. --- keyd.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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; } } -- 2.39.5