projects
/
u
/
mdw
/
catacomb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cfe65b2
)
Accept `-' as a name for standard input.
author
mdw
<mdw>
Fri, 30 Sep 2005 16:45:54 +0000
(16:45 +0000)
committer
mdw
<mdw>
Fri, 30 Sep 2005 16:45:54 +0000
(16:45 +0000)
hashsum.c
patch
|
blob
|
blame
|
history
diff --git
a/hashsum.c
b/hashsum.c
index
c9bb3ec
..
85fc6f4
100644
(file)
--- 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;
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);
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);
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));
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;
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));
fp = stdin;
else if ((fp = fopen(file, f & f_raw ? "r" : "rb")) == 0) {
moan("couldn't open `%s': %s", file, strerror(errno));