From 08b4098af974e519c85701607650fd14fbdf23ad Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sun, 3 Jun 2001 18:04:17 +0000 Subject: Nope, that's not right either. Fix check for mutually exclusive args. --- bin/md5/md5.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'bin') 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 @@ -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) -- cgit v1.2.3