summaryrefslogtreecommitdiff
path: root/userspace/grep.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-20 20:51:57 +0200
committerMiguel <m.i@gmx.at>2018-09-20 20:51:57 +0200
commitaeefdb37d1fc1c0eb7953b9c196cab09460bc167 (patch)
tree513789d7fd28b65afb594e9605975bd10ea06f74 /userspace/grep.c
parent763f85c55fdb5a2c4f5bf98e4989a69d27da6e4f (diff)
we are now prepared for piping with _pipe and _dup2
Diffstat (limited to 'userspace/grep.c')
-rw-r--r--userspace/grep.c17
1 files changed, 17 insertions, 0 deletions
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 <stdio.h>
+#include <stdlib.h>
+
+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;
+}