tee: "-" is a name for stdout, handle it that way

This commit is contained in:
Denis Vlasenko 2008-07-15 05:10:15 +00:00
parent 09ce45fd10
commit 4b8171cd7a

View File

@ -50,10 +50,13 @@ int tee_main(int argc, char **argv)
files[0] = stdout; files[0] = stdout;
goto GOT_NEW_FILE; goto GOT_NEW_FILE;
do { do {
*fp = fopen_or_warn(*argv, mode); *fp = stdout;
if (*fp == NULL) { if (NOT_LONE_DASH(*argv)) {
retval = EXIT_FAILURE; *fp = fopen_or_warn(*argv, mode);
continue; if (*fp == NULL) {
retval = EXIT_FAILURE;
continue;
}
} }
*np = *argv++; *np = *argv++;
GOT_NEW_FILE: GOT_NEW_FILE: