1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

cat(1) now writes to fd 1 instead of /dev/tty.

This commit is contained in:
Jonas 'Sortie' Termansen 2011-11-26 19:14:08 +01:00
parent 4cac495121
commit f45def4a68

View file

@ -10,9 +10,6 @@ int cat(int argc, char* argv[])
{ {
int result = 0; 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++ ) for ( int i = 1; i < argc; i++ )
{ {
int fd = open(argv[i], O_RDONLY); int fd = open(argv[i], O_RDONLY);
@ -35,7 +32,7 @@ int cat(int argc, char* argv[])
result = 1; result = 1;
break; break;
} }
if ( writeall(outfd, buffer, bytesread) ) if ( writeall(1, buffer, bytesread) )
{ {
error(0, errno, "write: %s", argv[i]); error(0, errno, "write: %s", argv[i]);
result = 1; result = 1;