]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(md5_check): Use the same message format when the single file has a
authorJim Meyering <jim@meyering.net>
Sat, 28 Oct 1995 21:01:01 +0000 (21:01 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 28 Oct 1995 21:01:01 +0000 (21:01 +0000)
read error or checksum mismatch as when there are more.
Write diagnostic to stderr, not stdout.

src/md5sum.c

index 43f75a39d9d8fe9a15b7c1e79afb1c97f8178496..db9828717a8e62c55ffbb23c2032b1f8860e97a3 100644 (file)
@@ -365,25 +365,18 @@ md5_check (const char *checkfile_name, int binary)
 
          if (n_open_or_read_failures > 0)
            {
-             printf (n_properly_formated_lines == 1
-               ? _("WARNING: the single listed file could not be read\n")
-               : _("WARNING: %d of the listed files could not be read\n"),
-                     n_open_or_read_failures);
+             error (0, 0,
+                  _("WARNING: %d of %d listed file%s could not be read\n"),
+                    n_open_or_read_failures, n_properly_formated_lines,
+                    (n_properly_formated_lines == 1 ? "" : "s"));
            }
 
-         if (n_mismatched_checksums == 0)
+         if (n_mismatched_checksums > 0)
            {
-             printf (n_properly_formated_lines == 1
-                     ? _("the single computed checksum matched\n")
-                     : _("all %d computed checksums matched\n"),
-                     n_computed_checkums);
-           }
-         else
-           {
-             printf (n_properly_formated_lines == 1
-             ? _("WARNING: the single computed checksum did NOT match\n")
-             : _("WARNING: %d out of %d computed checksums did NOT match\n"),
-                     n_mismatched_checksums, n_computed_checkums);
+             error (0, 0,
+                  _("WARNING: %d of %d computed checksum%s did NOT match\n"),
+                    n_mismatched_checksums, n_computed_checkums,
+                    (n_computed_checkums == 1 ? "" : "s"));
            }
        }
     }