summaryrefslogtreecommitdiff
path: root/tripping.c
blob: 911d229fd776477edfdc2e95c3468fc7d7d04ab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
}