diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2007-03-20 12:06:49 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2007-03-20 12:06:49 +0000 |
commit | e89cff3a5d99bf0bcdb6fc1b38737c07643aaa8e (patch) | |
tree | 59f1b08bc62f314bd2fce69e1d65e766f35d7584 /bin | |
parent | 5eb2ced892a32a85dd7a55cd1ac62b1f93a3587f (diff) |
augment the -q option, now if specifed with -c (checklist)
it will only print out the failed cases.
OK millert@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/md5/cksum.1 | 6 | ||||
-rw-r--r-- | bin/md5/md5.c | 14 |
2 files changed, 11 insertions, 9 deletions
diff --git a/bin/md5/cksum.1 b/bin/md5/cksum.1 index 5a12426c099..75fa75d6d28 100644 --- a/bin/md5/cksum.1 +++ b/bin/md5/cksum.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cksum.1,v 1.12 2007/02/27 21:41:58 millert Exp $ +.\" $OpenBSD: cksum.1,v 1.13 2007/03/20 12:06:48 thib Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -133,7 +133,9 @@ Use historic algorithms instead of the (superior) default one Echoes stdin to stdout and appends the checksum to stdout. .It Fl q -Only print the checksum (quiet mode). +Only print the checksum (quiet mode) or if used in conjunction with the +.Fl c +flag, only print the failed cases. .It Fl r Reverse the format of the hash algorithm output, making it match the checksum output format. diff --git a/bin/md5/md5.c b/bin/md5/md5.c index 87f5b4e151d..8cd344b1756 100644 --- a/bin/md5/md5.c +++ b/bin/md5/md5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: md5.c,v 1.39 2007/01/09 18:06:07 deraadt Exp $ */ +/* $OpenBSD: md5.c,v 1.40 2007/03/20 12:06:48 thib Exp $ */ /* * Copyright (c) 2001,2003,2005-2006 Todd C. Miller <Todd.Miller@courtesan.com> @@ -165,13 +165,14 @@ void digest_test(struct hash_functions **); void digest_time(struct hash_functions **); extern char *__progname; +int qflag = 0; int main(int argc, char **argv) { struct hash_functions *hf, *hashes[NHASHES + 1]; int fl, i, error; - int cflag, pflag, qflag, rflag, tflag, xflag; + int cflag, pflag, rflag, tflag, xflag; char *cp, *input_string; input_string = NULL; @@ -249,8 +250,6 @@ main(int argc, char **argv) if (hashes[1] != NULL) errx(1, "only a single algorithm may be specified " "in -c mode"); - if (qflag) - errx(1, "the -q and -c flags are mutually exclusive"); } /* No algorithm specified, check the name we were called as. */ @@ -523,9 +522,10 @@ digest_filelist(const char *file, struct hash_functions *defhash) close(fd); (void)hf->end(&context, digest); - if (strcasecmp(checksum, digest) == 0) - (void)printf("(%s) %s: OK\n", algorithm, filename); - else { + if (strcasecmp(checksum, digest) == 0) { + if (qflag == 0) + (void)printf("(%s) %s: OK\n", algorithm, filename); + } else { (void)printf("(%s) %s: FAILED\n", algorithm, filename); error = 1; } |