From 880e41fa961173652b4a414b1e6740f610421a21 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 19 Dec 2018 08:58:36 -0800 Subject: md5sum/sha1sum: add --status and --check, fix --check with multiple files. Annoyingly coreutils and busybox both have the --status functionality, but coreutils only accepts --status and busybox only accepts -s. Although all extant users known to me use --status I've supported both (a) for maximum compatibility and (b) because Rob hates longopts :-) Also, -c/--check don't take argument(s): they alter the interpretation of all the FILE... arguments. I removed a bunch of dead code here, but I couldn't switch us over to loopfiles_lines because I didn't want to regress on the "warn if any check file contains no hashes", and loopfiles_lines doesn't give you any way to recognize that you've moved on to the next file. --- tests/md5sum.test | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/md5sum.test') diff --git a/tests/md5sum.test b/tests/md5sum.test index f159d1ed..cda9871f 100755 --- a/tests/md5sum.test +++ b/tests/md5sum.test @@ -28,3 +28,12 @@ testing "-c spaces" "md5sum -c input || echo ok" \ rm "te st" empty testing "-c nolines" "md5sum -c input 2>/dev/null || echo ok" "ok\n" "" "" + +touch empty +echo "d41d8cd98f00b204e9800998ecf8427e empty" > list +echo "041d8cd98f00b204e9800998ecf8427e empty" > badlist +testing "--status okay" "md5sum --status -c list ; echo \$?" "0\n" "" "" +testing "--status fail" "md5sum --status -c badlist ; echo \$?" "1\n" "" "" +testing "-c multiple" "md5sum -c list badlist --status ; echo \$?" "1\n" "" "" + +rm empty list badlist -- cgit v1.2.3