From 8504d5165f2257fe7d3899c219caaad8b8964705 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Fri, 30 Nov 2007 09:36:27 +0100 Subject: [PATCH] Implement usage Signed-off-by: Pierre Habouzit --- main-postlicyd.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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) { -- 2.20.1