aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-02-22 04:59:16 +0000
committerEric Andersen <andersen@codepoet.org>2001-02-22 04:59:16 +0000
commit7aa1f5c42afbdf4574ef477de826051dd4c61158 (patch)
treef4fbf8154cd8611e892f503121bbc77cc31bb64f
parentdbcd8ce464afb6474698c19143265cf7572b6129 (diff)
downloadbusybox-7aa1f5c42afbdf4574ef477de826051dd4c61158.tar.gz
Make md5sum not display filename when reading stdin
-Erik
-rw-r--r--coreutils/md5sum.c7
-rw-r--r--md5sum.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c
index fa11ee61d..e4f52075d 100644
--- a/coreutils/md5sum.c
+++ b/coreutils/md5sum.c
@@ -901,7 +901,12 @@ int md5sum_main(int argc,
fail = md5_file (file, binary, md5buffer);
err |= fail;
- if (!fail) {
+ if (!fail && STREQ(file, "-")) {
+ size_t i;
+ for (i = 0; i < 16; ++i)
+ printf ("%02x", md5buffer[i]);
+ putchar ('\n');
+ } else if (!fail) {
size_t i;
/* Output a leading backslash if the file name contains
a newline or backslash. */
diff --git a/md5sum.c b/md5sum.c
index fa11ee61d..e4f52075d 100644
--- a/md5sum.c
+++ b/md5sum.c
@@ -901,7 +901,12 @@ int md5sum_main(int argc,
fail = md5_file (file, binary, md5buffer);
err |= fail;
- if (!fail) {
+ if (!fail && STREQ(file, "-")) {
+ size_t i;
+ for (i = 0; i < 16; ++i)
+ printf ("%02x", md5buffer[i]);
+ putchar ('\n');
+ } else if (!fail) {
size_t i;
/* Output a leading backslash if the file name contains
a newline or backslash. */