From: Pierre Habouzit Date: Fri, 30 Nov 2007 08:36:27 +0000 (+0100) Subject: Implement usage X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=8504d5165f2257fe7d3899c219caaad8b8964705;p=apps%2Fpfixtools.git Implement usage Signed-off-by: Pierre Habouzit --- diff --git a/main-postlicyd.c b/main-postlicyd.c index fe4a851..04172dd 100644 --- a/main-postlicyd.c +++ b/main-postlicyd.c @@ -38,6 +38,8 @@ #include "epoll.h" #include "threads.h" +#define DAEMON_NAME "postlicyd" + /* administrivia {{{ */ static int main_initialize(void) @@ -59,6 +61,15 @@ static void main_shutdown(void) module_init(main_initialize); module_exit(main_shutdown); +void usage(void) +{ + fputs("usage: "DAEMON_NAME" [options] config\n" + "\n" + "Options:\n" + " -p file to write our pid to\n" + , stderr); +} + /* }}} */ void *job_run(int fd, void *data) @@ -100,11 +111,16 @@ int main(int argc, char *argv[]) pidfile = optarg; break; default: - //usage(); + usage(); return EXIT_FAILURE; } } + if (argc - optind != 1) { + usage(); + return EXIT_FAILURE; + } + if (pidfile) { f = fopen(pidfile, "w"); if (!f) {