bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Checking multiple .md5 files


From: Shish
Subject: Checking multiple .md5 files
Date: Sun, 03 Jul 2005 20:58:38 +0100
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050404)

Having finally become fed up with "cat *.md5 | md5sum -c" enough to do something about it, I edited md5sum to allow "md5sum -c *.md5". sha1sum is also affected by way of using the same code.

The patch is against 5.2.1 rather than CVS as I couldn't get it to compile properly (autoconf version problems), but with only 7 lines taken out and 9 added in it shouldn't be too hard to apply manually :)

    -- Shish
--- coreutils-5.2.1-orig/src/md5sum.c   2004-01-21 22:27:02.000000000 +0000
+++ coreutils-5.2.1/src/md5sum.c        2005-07-03 19:57:16.000000000 +0100
@@ -663,15 +663,17 @@
     }
   else if (do_check)
     {
-      if (optind + 1 < argc)
+      if(optind == argc)
        {
-         error (0, 0,
-                _("only one argument may be specified when using --check"));
-         usage (EXIT_FAILURE);
+         err = digest_check ("-", DIGEST_STREAM (algorithm));
+        }
+      else
+        {
+         while(optind < argc)
+           {
+              err |= digest_check (argv[optind++], DIGEST_STREAM (algorithm));
+           }
        }
-
-      err = digest_check ((optind == argc) ? "-" : argv[optind],
-                         DIGEST_STREAM (algorithm));
     }
   else
     {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]