tee: "-" is a name for stdout, handle it that way
authorDenis Vlasenko <vda.linux@googlemail.com>
Tue, 15 Jul 2008 05:10:15 +0000 (05:10 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Tue, 15 Jul 2008 05:10:15 +0000 (05:10 -0000)
coreutils/tee.c

index b38801755b2dda95ee7b505db2535756ef0e3b45..8a4128591c4b8af0adabad0afe2b765b78112f58 100644 (file)
@@ -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: