[hackers] [sbase] read stdin if arg is exactly "-" not just begins with '-' || Evan Gates
commit 148e6e3b7979fce87fc85c88816110b704dc1841
Author: Evan Gates <evan.gates_AT_gmail.com>
Date: Tue Nov 18 13:41:52 2014 -0800
read stdin if arg is exactly "-" not just begins with '-'
diff --git a/cat.c b/cat.c
index a7842c8..fbf8069 100644
--- a/cat.c
+++ b/cat.c
_AT_@ -30,7 +30,7 @@ main(int argc, char *argv[])
concat(stdin, "<stdin>", stdout, "<stdout>");
} else {
for (; argc; argc--, argv++) {
- if (argv[0][0] == '-')
+ if (argv[0][0] == '-' && !argv[0][1])
argv[0] = "/dev/fd/0";
if (!(fp = fopen(argv[0], "r"))) {
weprintf("fopen %s:", argv[0]);
Received on Tue Nov 18 2014 - 22:53:41 CET
This archive was generated by hypermail 2.3.0
: Tue Nov 18 2014 - 23:00:22 CET