summaryrefslogtreecommitdiff
path: root/src/md5sum.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1995-10-28 21:01:01 +0000
committerJim Meyering <jim@meyering.net>1995-10-28 21:01:01 +0000
commitc5716550a6f0ac218158daa5a32b0225f94a8042 (patch)
tree9d25f0467c6fdbd0ff95ba4b4b27870b111d10f6 /src/md5sum.c
parentb43f5fb25b81b45f0a9a24056b5d883f6f4dd8a5 (diff)
downloadcoreutils-c5716550a6f0ac218158daa5a32b0225f94a8042.tar.xz
(md5_check): Use the same message format when the single file has a
read error or checksum mismatch as when there are more. Write diagnostic to stderr, not stdout.
Diffstat (limited to 'src/md5sum.c')
-rw-r--r--src/md5sum.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/md5sum.c b/src/md5sum.c
index 43f75a39d..db9828717 100644
--- a/src/md5sum.c
+++ b/src/md5sum.c
@@ -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"));
}
}
}