summaryrefslogtreecommitdiff
path: root/tripping.c
diff options
context:
space:
mode:
authorToby Goodwin <tjg@star.le.ac.uk>1999-01-11 10:55:18 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:22:09 +0100
commite11c7df86144bed383ac6bbeaecc3017d18b37db (patch)
tree6fad44921723eab2f2eb1c76b7214b4e79b818f3 /tripping.c
parent671e1e2d1599aa8c5f1010b3fe75c151c56a7403 (diff)
beta: rc-1.5b4
Diffstat (limited to 'tripping.c')
-rw-r--r--tripping.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tripping.c b/tripping.c
new file mode 100644
index 0000000..911d229
--- /dev/null
+++ b/tripping.c
@@ -0,0 +1,33 @@
+/* This is an auxiliary test program for rc. */
+
+#include <fcntl.h>
+#include <stdio.h>
+
+void out0(void) {
+ putchar('t'); putchar('r');
+ putchar('\0');
+ putchar('u'); putchar('e');
+ putchar('\n');
+}
+
+void makenonblock(void) {
+ int flags;
+
+ if ((flags = fcntl(0, F_GETFL)) == -1)
+ perror("fcntl 1");
+ flags |= O_NONBLOCK;
+ if (fcntl(0, F_SETFL, (long) flags) == -1)
+ perror("fcntl 2");
+}
+
+int main(int argc, char **argv) {
+ switch(argv[1][0]) {
+ case '0':
+ out0();
+ break;
+ case 'n':
+ makenonblock();
+ break;
+ }
+ return 0;
+}