summaryrefslogtreecommitdiff
path: root/stdio
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1994-05-23 23:35:24 +0000
committerRoland McGrath <roland@gnu.org>1994-05-23 23:35:24 +0000
commit7ea52bc1d81b6ccbeaead125db6ee98accba107b (patch)
treee0a605bb092d1feeed8a381a2d3c522bef8fc610 /stdio
parent45cc8a1ec513decfc57800840149ecf7f76e4761 (diff)
Initial revision
Diffstat (limited to 'stdio')
-rw-r--r--stdio/xbug.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/stdio/xbug.c b/stdio/xbug.c
new file mode 100644
index 0000000000..9073a2dec5
--- /dev/null
+++ b/stdio/xbug.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+
+main()
+{
+ char * filename = "xbug.c";
+ FILE *input;
+ int i;
+ char buf[256];
+
+
+ if (!freopen (filename, "r", stdin))
+ fprintf(stderr, "cannot open file\n");
+
+ if (!(input = popen("/bin/cat", "r")))
+ fprintf(stderr, "cannot run \n");
+
+
+ while(gets(buf) != NULL) {
+ fprintf(stdout, "read: %s\n", buf);
+ }
+}