From 9c99db15c28099a2b33d40a670e40ae350158a8a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Wed, 21 Jul 2010 13:52:51 +0200 Subject: [PATCH] Help and usage fix Option -h was added. Also details about options were added into usage. --- src/cron.c | 54 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/src/cron.c b/src/cron.c index c99c155..5c28e3a 100644 --- a/src/cron.c +++ b/src/cron.c @@ -123,11 +123,17 @@ static void handle_signals(cron_db * database) { static void usage(void) { const char **dflags; - fprintf(stderr, "usage: %s [-n] [-p] [-s] [-i] [-m ] [-x [", + fprintf(stderr, "usage: %s [-h] print this message \n \ + [-i] deamon runs without inotify support \n \ + [-m ] off or specify prefered client for sending mails \n \ + [-n] run in foreground \n \ + [-p] permit any crontab \n \ + [-s] log into syslog instead of sending mails \n \ + [-x [", ProgramName); for (dflags = DebugFlagNames; *dflags; dflags++) fprintf(stderr, "%s%s", *dflags, dflags[1] ? "," : "]"); - fprintf(stderr, "]\n"); + fprintf(stderr, "] print debug information\n"); exit(ERROR_EXIT); } @@ -587,29 +593,31 @@ static void sigchld_reaper(void) { static void parse_args(int argc, char *argv[]) { int argch; - while (-1 != (argch = getopt(argc, argv, "npsix:m:"))) { + while (-1 != (argch = getopt(argc, argv, "hnpsix:m:"))) { switch (argch) { - default: - usage(); - case 'x': - if (!set_debug_flags(optarg)) + case 'x': + if (!set_debug_flags(optarg)) + usage(); + break; + case 'n': + NoFork = 1; + break; + case 'p': + PermitAnyCrontab = 1; + break; + case 's': + SyslogOutput = 1; + break; + case 'i': + DisableInotify = 1; + break; + case 'm': + strncpy(MailCmd, optarg, MAX_COMMAND); + break; + case 'h': + default: usage(); - break; - case 'n': - NoFork = 1; - break; - case 'p': - PermitAnyCrontab = 1; - break; - case 's': - SyslogOutput = 1; - break; - case 'i': - DisableInotify = 1; - break; - case 'm': - strncpy(MailCmd, optarg, MAX_COMMAND); - break; + break; } } } -- 2.40.0