From 4b8171cd7ac73f9dfaf3873ee5a964e6801be9e4 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 15 Jul 2008 05:10:15 +0000 Subject: tee: "-" is a name for stdout, handle it that way --- coreutils/tee.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'coreutils') diff --git a/coreutils/tee.c b/coreutils/tee.c index b38801755..8a4128591 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: -- cgit v1.2.3