diff options
author | Jim Meyering <jim@meyering.net> | 1995-08-09 02:50:09 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1995-08-09 02:50:09 +0000 |
commit | 26574d5284c71b893df1b63a1fe823d65b5a476c (patch) | |
tree | da6d6d9f9caeb60955a31eb285f9fb2c02275f3c /src | |
parent | c02722d395118cbb0a2e6187339b08702d107bce (diff) | |
download | coreutils-26574d5284c71b893df1b63a1fe823d65b5a476c.tar.xz |
(md5_check): Fail if no valid line is found.
Don't use the word `fail' unless there were failures --
say `all N tests passed.'
Diffstat (limited to 'src')
-rw-r--r-- | src/md5sum.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/md5sum.c b/src/md5sum.c index c3e7ab56b..48980b2f9 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -96,8 +96,8 @@ usage (status) else printf (_("\ Usage: %s [OPTION] [FILE]...\n\ - or: %s [OPTION] --string=STRING\n\ or: %s [OPTION] --check [FILE]\n\ + or: %s [OPTION] --string=STRING ...\n\ Print or check MD5 checksums.\n\ With no FILE, or when FILE is -, read standard input.\n\ \n\ @@ -341,14 +341,31 @@ md5_check (checkfile_name, binary) return 1; } - if (!quiet) - printf (n_tests == 1 ? (n_tests_failed ? _("Test failed\n") - : _("Test passed\n")) - : _("%d out of %d tests failed\n"), - n_tests_failed, n_tests); + if (n_tests == 0) + { + /* FIXME: warn (or even fail?) if no tests are found? */ + } + else + { + if (!quiet) + { + if (n_tests_failed == 0) + { + printf (n_tests == 1 + ? _("the single test passed\n") + : _("all %d tests passed\n"), n_tests); + } + else + { + printf (n_tests == 1 + ? _("the single test failed\n") + : _("%d out of %d tests failed\n"), + n_tests_failed, n_tests); + } + } + } - /* FIXME: warn if no tests are found? */ - return (n_tests_failed == 0 ? 0 : 1); + return ((n_tests > 0 && n_tests_failed == 0) ? 0 : 1); } int |