diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-06-03 18:04:17 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-06-03 18:04:17 +0000 |
commit | 08b4098af974e519c85701607650fd14fbdf23ad (patch) | |
tree | b1002f210c995efdc6dfa9fa0ed2bb09d54bc521 /bin | |
parent | 8a9270e974a707b6350bb4eae35a02e816007951 (diff) |
Nope, that's not right either. Fix check for mutually exclusive args.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/md5/md5.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/md5/md5.c b/bin/md5/md5.c index 284d3661e1e..c32980a4c84 100644 --- a/bin/md5/md5.c +++ b/bin/md5/md5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: md5.c,v 1.12 2001/06/03 17:02:53 espie Exp $ */ +/* $OpenBSD: md5.c,v 1.13 2001/06/03 18:04:16 millert Exp $ */ /* * Copyright (c) 2001 Todd C. Miller <Todd.Miller@courtesan.com> @@ -81,7 +81,7 @@ static void digest_time(struct hash_functions *); int main(int argc, char **argv) { - int ch, digest_type; + int fl, digest_type; int pflag, tflag, xflag; char *input_string; @@ -95,8 +95,8 @@ main(int argc, char **argv) input_string = NULL; pflag = tflag = xflag = 0; - while ((ch = getopt(argc, argv, "ps:tx")) != -1) { - switch (ch) { + while ((fl = getopt(argc, argv, "ps:tx")) != -1) { + switch (fl) { case 'p': pflag = 1; break; @@ -116,7 +116,9 @@ main(int argc, char **argv) argc -= optind; argv += optind; - if (pflag + tflag + xflag + argc < 1) + /* All arguments are mutually exclusive */ + fl = pflag + tflag + xflag + (input_string != NULL); + if (fl > 1 || (fl && argc)) usage(); if (tflag) |