From d7e6bc667592a29ab0b9aa8631cdd6162e3f94a1 Mon Sep 17 00:00:00 2001 From: mdw Date: Fri, 30 Sep 2005 16:45:54 +0000 Subject: [PATCH] Accept `-' as a name for standard input. --- hashsum.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hashsum.c b/hashsum.c index c9bb3ec..85fc6f4 100644 --- a/hashsum.c +++ b/hashsum.c @@ -211,7 +211,7 @@ static int fhash(const char *file, unsigned f, const gchash *gch, void *buf) ghash *h; int e; - if (!file) + if (!file || strcmp(file, "-") == 0) fp = stdin; else if ((fp = fopen(file, f & f_binary ? "rb" : "r")) == 0) return (-1); @@ -441,7 +441,7 @@ static int checkhash(const char *file, unsigned f, unsigned long n = 0, nfail = 0; octet *buf = xmalloc(2 * gch->hashsz); - if (!file) + if (!file || strcmp(file, "-") == 0) fp = stdin; else if ((fp = fopen(file, f & f_raw ? "r" : "rb")) == 0) { moan("couldn't open `%s': %s", file, strerror(errno)); @@ -571,7 +571,7 @@ static int hashfiles(const char *file, unsigned f, int rc = 0; int rrc; - if (!file) + if (!file || strcmp(file, "-") == 0) fp = stdin; else if ((fp = fopen(file, f & f_raw ? "r" : "rb")) == 0) { moan("couldn't open `%s': %s", file, strerror(errno)); -- 2.11.0