summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-07-15 05:10:15 +0000
committerDenis Vlasenko2008-07-15 05:10:15 +0000
commit4b8171cd7ac73f9dfaf3873ee5a964e6801be9e4 (patch)
tree5ce006f6ee2ae6cabc619acf35c3179dfc67a2b7
parent09ce45fd10c53b27023ebad7e9bc25cb68b3f06b (diff)
downloadbusybox-4b8171cd7ac73f9dfaf3873ee5a964e6801be9e4.zip
busybox-4b8171cd7ac73f9dfaf3873ee5a964e6801be9e4.tar.gz
tee: "-" is a name for stdout, handle it that way
-rw-r--r--coreutils/tee.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/coreutils/tee.c b/coreutils/tee.c
index b388017..8a41285 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -50,10 +50,13 @@ int tee_main(int argc, char **argv)
files[0] = stdout;
goto GOT_NEW_FILE;
do {
- *fp = fopen_or_warn(*argv, mode);
- if (*fp == NULL) {
- retval = EXIT_FAILURE;
- continue;
+ *fp = stdout;
+ if (NOT_LONE_DASH(*argv)) {
+ *fp = fopen_or_warn(*argv, mode);
+ if (*fp == NULL) {
+ retval = EXIT_FAILURE;
+ continue;
+ }
}
*np = *argv++;
GOT_NEW_FILE: