From aeefdb37d1fc1c0eb7953b9c196cab09460bc167 Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 20 Sep 2018 20:51:57 +0200 Subject: we are now prepared for piping with _pipe and _dup2 --- userspace/grep.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 userspace/grep.c (limited to 'userspace/grep.c') diff --git a/userspace/grep.c b/userspace/grep.c new file mode 100644 index 0000000..c37392f --- /dev/null +++ b/userspace/grep.c @@ -0,0 +1,17 @@ +#include +#include + +int main(int argc, char **argv) +{ + while(1) + { + char buf[256]; + int l=fread(buf,1,255,stdin); + if(l==0)break; + buf[l]=0; + printf("grep: %s",buf); + + } + + return EXIT_SUCCESS; +} -- cgit v1.2.3