From c5716550a6f0ac218158daa5a32b0225f94a8042 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 28 Oct 1995 21:01:01 +0000 Subject: (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. --- src/md5sum.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/md5sum.c') 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")); } } } -- cgit v1.2.3-70-g09d2