From 7b0d88b2dff9b635d9ff69f6d51b6832c1ca4c40 Mon Sep 17 00:00:00 2001 From: Miguel Date: Sat, 18 Aug 2018 13:23:53 +0200 Subject: cleaning up syscalls and playing with new pipes --- userspace/cat.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'userspace/cat.c') diff --git a/userspace/cat.c b/userspace/cat.c index a371397..8980546 100644 --- a/userspace/cat.c +++ b/userspace/cat.c @@ -2,16 +2,14 @@ int main() { - FILE *f = fopen("README", "r"); - if (f == NULL) - { - perror("unable to open file"); - return 1; - } - puts("open success"); - fclose(f); + char buf[256]; + + while(has_data_waiting(2)){ + fread(buf,1,5,stderr); // read stderr; + printf("[%s]\n",buf); + } return 0; } -- cgit v1.2.3