summaryrefslogtreecommitdiff
path: root/src/tee.c
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2015-02-20 08:10:51 +0100
committerBernhard Voelker <mail@bernhard-voelker.de>2015-02-20 14:00:41 +0100
commit7ceaf1d975a17d07f1704d8edf4476218148cfba (patch)
tree81aa51f01ff422b9a7224372c27236a63eb26b40 /src/tee.c
parent3f2f05f06763d79a7cab525a3ea2d726df3e3736 (diff)
downloadcoreutils-7ceaf1d975a17d07f1704d8edf4476218148cfba.tar.xz
tee: treat '-' operand as file name as mandated by POSIX
Since v5.2.1-1247-g8dafbe5, tee(1) treated '-' as stdout while POSIX explicitly requires to treat this as a file name. Revert this change, as the interleaved output - due to sending another copy of input to stdout - is not considered to be useful. Discussed in http://lists.gnu.org/archive/html/coreutils/2015-02/msg00085.html * src/tee.c (tee_files): Remove the special handling for "-" operands. (usage): Remove the corresponding sentence. * doc/coreutils.texi (common options): Remove the "tee -" example. (tee invocation): Document that tee(1) now treats "-" as a file name. * tests/misc/tee.sh: Add a test case for "tee -". While at it, re-indent the above multi-argument processing case and extend that to 13 operands, as POSIX mandates that, too. * tests/misc/tee-dash.sh: Remove now-obsolete test. * tests/local.mk (all_tests): Remove the above test. * NEWS (Changes in behavior): Mention the change.
Diffstat (limited to 'src/tee.c')
-rw-r--r--src/tee.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/tee.c b/src/tee.c
index bfe1b6900..feb402628 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -68,10 +68,6 @@ Copy standard input to each FILE, and also to standard output.\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
- fputs (_("\
-\n\
-If a FILE is -, copy again to standard output.\n\
-"), stdout);
emit_ancillary_info (PROGRAM_NAME);
}
exit (status);
@@ -169,9 +165,8 @@ tee_files (int nfiles, const char **files)
for (i = 1; i <= nfiles; i++)
{
- descriptors[i] = (STREQ (files[i], "-")
- ? stdout
- : fopen (files[i], mode_string));
+ /* Do not treat "-" specially - as mandated by POSIX. */
+ descriptors[i] = fopen (files[i], mode_string);
if (descriptors[i] == NULL)
{
error (0, errno, "%s", files[i]);