From 4fdd9b83fca2f12318a2914654b63079e634410d Mon Sep 17 00:00:00 2001 From: dtrg Date: Wed, 10 Aug 2005 22:48:40 +0000 Subject: [PATCH] Converted to use termios, not sgtty. (pbetti@e-tech.net) --- mach/i80/dl/nascom.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/mach/i80/dl/nascom.c b/mach/i80/dl/nascom.c index 260832fa0..e411d9c60 100644 --- a/mach/i80/dl/nascom.c +++ b/mach/i80/dl/nascom.c @@ -12,7 +12,9 @@ */ #include #include -#include +/*#include */ +#include +#include #include #include @@ -26,8 +28,10 @@ char hex[] = "0123456789ABCDEF"; char *progname; -struct sgttyb ttynormal; -struct sgttyb ttyraw; +/*struct sgttyb ttynormal; +struct sgttyb ttyraw;*/ +struct termios ttynormal; +struct termios ttyraw; int rawmode = 0; struct outhead ohead; @@ -35,7 +39,8 @@ struct outsect sect[MAXSECT]; stop(code) { if (rawmode) - stty(1, &ttynormal); + /*stty(1, &ttynormal);*/ + tcsetattr(1, TCSAFLUSH, &ttynormal); exit(code); } @@ -81,16 +86,22 @@ main(argc,argv) char **argv; { signal(SIGINT, SIG_IGN); signal(SIGQUIT, stop); signal(SIGTERM, stop); - if (gtty(1, &ttynormal) < 0) { + /*if (gtty(1, &ttynormal) < 0) {*/ + if (tcgetattr(1, &ttynormal) < 0) { fprintf(stderr, "no tty\n"); stop(-1); } rawmode++; ttyraw = ttynormal; + /* ttyraw.sg_flags |= RAW; ttyraw.sg_ispeed = B1200; ttyraw.sg_ospeed = B1200; stty(1, &ttyraw); + */ + cfmakeraw(&ttyraw); + cfsetispeed(&ttyraw, B1200); + cfsetospeed(&ttyraw, B1200); sleep(5); } rd_ohead(&ohead);