diff options
author | sheldonh <sheldonh@FreeBSD.org> | 1999-06-18 08:52:13 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 1999-06-18 08:52:13 +0000 |
commit | cc616cd95b9963c6bcd6b3e97ab81e34a4d75076 (patch) | |
tree | fc622ff2cb0dd0162b9336ae7666f80c79c4ef02 /usr.bin | |
parent | a15847dddbce5e2d2315b631e87d5e0173e22f94 (diff) | |
download | FreeBSD-src-cc616cd95b9963c6bcd6b3e97ab81e34a4d75076.zip FreeBSD-src-cc616cd95b9963c6bcd6b3e97ab81e34a4d75076.tar.gz |
Postpone call to usage() until after all options are processed so that
the -d debugging option produces consistent behaviour.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/vacation/vacation.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/vacation/vacation.c b/usr.bin/vacation/vacation.c index 6413341..b94afe7 100644 --- a/usr.bin/vacation/vacation.c +++ b/usr.bin/vacation/vacation.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)from: vacation.c 8.2 (Berkeley) 1/26/94"; #endif static const char rcsid[] = - "$Id: vacation.c,v 1.15 1999/06/17 14:48:02 sheldonh Exp $"; + "$Id: vacation.c,v 1.16 1999/06/17 14:49:19 sheldonh Exp $"; #endif /* not lint */ /* @@ -114,9 +114,9 @@ main(argc, argv) struct passwd *pw; ALIAS *cur; time_t interval; - int ch, iflag, lflag, mfail; + int ch, iflag, lflag, mfail, ufail; - opterr = iflag = lflag = mfail = 0; + opterr = iflag = lflag = mfail = ufail = 0; interval = -1; while ((ch = getopt(argc, argv, "a:dIilr:")) != -1) { switch((char)ch) { @@ -143,24 +143,27 @@ main(argc, argv) if (isdigit(*optarg)) { interval = atol(optarg) * 86400; if (interval < 0) - usage(); + ufail++; } else interval = LONG_MAX; break; case '?': default: - usage(); + ufail++; } } - /* Only die on the above malloc failure here so that the + /* + * Only die on the above malloc and usage errors here so that the * correct logging medium is used. */ if (mfail) { msglog(LOG_ERR, "vacation: malloc failed\n"); exit(EX_TEMPFAIL); } + else if (ufail) + usage(); argc -= optind; argv += optind; |