From f45def4a68277ba80f90c483b4cf4a29ab5e03f2 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sat, 26 Nov 2011 19:14:08 +0100 Subject: [PATCH] cat(1) now writes to fd 1 instead of /dev/tty. --- utils/cat.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/utils/cat.cpp b/utils/cat.cpp index 0b525f8c..9a707846 100644 --- a/utils/cat.cpp +++ b/utils/cat.cpp @@ -10,9 +10,6 @@ int cat(int argc, char* argv[]) { int result = 0; - int outfd = open("/dev/tty", O_WRONLY | O_APPEND); - if ( outfd < 0 ) { error(0, errno, "%s", "/dev/tty"); return 1; } - for ( int i = 1; i < argc; i++ ) { int fd = open(argv[i], O_RDONLY); @@ -35,7 +32,7 @@ int cat(int argc, char* argv[]) result = 1; break; } - if ( writeall(outfd, buffer, bytesread) ) + if ( writeall(1, buffer, bytesread) ) { error(0, errno, "write: %s", argv[i]); result = 1;