read stdin if arg is exactly "-" not just begins with '-'

This commit is contained in:
Evan Gates 2014-11-18 13:41:52 -08:00 committed by sin
parent 84b08427a1
commit 148e6e3b79
1 changed files with 1 additions and 1 deletions

2
cat.c
View File

@ -30,7 +30,7 @@ main(int argc, char *argv[])
concat(stdin, "<stdin>", stdout, "<stdout>"); concat(stdin, "<stdin>", stdout, "<stdout>");
} else { } else {
for (; argc; argc--, argv++) { for (; argc; argc--, argv++) {
if (argv[0][0] == '-') if (argv[0][0] == '-' && !argv[0][1])
argv[0] = "/dev/fd/0"; argv[0] = "/dev/fd/0";
if (!(fp = fopen(argv[0], "r"))) { if (!(fp = fopen(argv[0], "r"))) {
weprintf("fopen %s:", argv[0]); weprintf("fopen %s:", argv[0]);