aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-14 14:23:20 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-14 14:24:15 +0200
commit646ae6344ae040220b75744c8fa9d955a46fe681 (patch)
treee9337dca1562a970f7d7d93b9ae2d12163eae062
parent3cfbd2d3be63b0176f7ea0ecf09e2cdc462d4e72 (diff)
downloadrtty-646ae6344ae040220b75744c8fa9d955a46fe681.tar.gz
Remove rin.c
-rw-r--r--rin.c73
1 files changed, 0 insertions, 73 deletions
diff --git a/rin.c b/rin.c
deleted file mode 100644
index 6af10b8..0000000
--- a/rin.c
+++ /dev/null
@@ -1,73 +0,0 @@
-#include <curses.h>
-#include <err.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/select.h>
-
-#define MAXBUF 1024
-
-int
-main()
-{
- fd_set rfds;
- int bufin[MAXBUF], bufout[MAXBUF], c, in, nin, nout, out, startx, y;
- struct timeval tv;
- WINDOW *w;
-
- w = initscr();
- raw();
- noecho();
- timeout(1);
-
- if((in = open("/var/tmp/r.in", O_RDWR)) == -1)
- err(1, "/var/tmp/r.in");
- if((out = open("/var/tmp/r.out", O_RDWR)) == -1)
- err(1, "/var/tmp/r.out");
-
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- FD_ZERO(&rfds);
-
- startx = 0;
- nin = 0;
-
- for(;;){
- FD_SET(out, &rfds);
- if(select(out+1, &rfds, NULL, NULL, &tv) > 0){
- nout = read(out, bufout, MAXBUF);
- bufout[nout+1] = 0;
- printw("%s", bufout);
- refresh();
-
- startx = -1;
- }
- if((c = getch()) != ERR){
- if(startx == -1)
- startx = getcurx(w);
- if(c == 26) /* ^Z */
- break;
- if(c == 21){ /* ^U */
-reset: bufin[0] = nin = 0;
- y = getcury(w);
- move(y, startx);
- refresh();
- continue;
- }
-
- bufin[nin++] = c;
-
- if(c == '\n'){
- bufin[nin] = 0;
- dprintf(in, "%s", bufin);
- goto reset;
- }else{
- printw("%c", c);
- refresh();
- }
- }
- }
-
- echo();
- noraw();
- endwin();
-}