rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit 3b225b2f889a79e3b3dfef6a962e5655c91c1a96
parent 0415699153be7beae0af2a2c375075cecc64794b
Author: tgoodwin <tgoodwin>
Date:   Thu, 29 Oct 1998 14:13:23 +0000

Initial revision

Diffstat:
Atripping.c | 33+++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+), 0 deletions(-)

diff --git a/tripping.c 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; +}