diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2005-07-19 07:34:55 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2005-07-19 07:34:55 +0000 |
commit | eb3bd006a1a3b582b033c114dbd73484e727a947 (patch) | |
tree | 98499259794a7bf8cfcbb7bfea7a5ea740450afc /src | |
parent | b6bf2399188fe3e8efbbd60645a9d1305014c6d3 (diff) | |
download | coreutils-eb3bd006a1a3b582b033c114dbd73484e727a947.tar.xz |
(usage, main): --check now accepts multiple input files.
Diffstat (limited to 'src')
-rw-r--r-- | src/md5sum.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/src/md5sum.c b/src/md5sum.c index 66c2adc00..3acf73258 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -107,7 +107,6 @@ usage (int status) { printf (_("\ Usage: %s [OPTION] [FILE]...\n\ - or: %s [OPTION] --check [FILE]\n\ Print or check %s (%d-bit) checksums.\n\ With no FILE, or when FILE is -, read standard input.\n\ \n\ @@ -124,7 +123,7 @@ With no FILE, or when FILE is -, read standard input.\n\ -b, --binary read in binary mode\n\ "), stdout); printf (_("\ - -c, --check check %s sums against given list\n"), + -c, --check read %s sums from the FILEs and check them\n"), DIGEST_TYPE_STRING (algorithm)); if (O_BINARY) fputs (_("\ @@ -613,27 +612,17 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } - if (do_check) - { - if (optind + 1 < argc) - { - error (0, 0, _("extra operand %s"), quote (argv[optind + 1])); - fprintf (stderr, "%s\n", - _("Only one operand may be specified when using --check.")); - usage (EXIT_FAILURE); - } + if (optind == argc) + argv[argc++] = "-"; - ok = digest_check (optind == argc ? "-" : argv[optind], - DIGEST_STREAM (algorithm)); - } - else + for (; optind < argc; ++optind) { - if (optind == argc) - argv[argc++] = "-"; + char *file = argv[optind]; - for (; optind < argc; ++optind) + if (do_check) + ok &= digest_check (file, DIGEST_STREAM (algorithm)); + else { - char *file = argv[optind]; int file_is_binary = binary; if (! digest_file (file, &file_is_binary, bin_buffer, |