$NetBSD: patch-ak,v 1.1 2001/03/16 11:05:46 wiz Exp $ --- term.c.orig Wed Nov 2 19:44:28 1994 +++ term.c @@ -64,7 +64,10 @@ #include "ispell.h" #include "proto.h" #include "msgs.h" -#ifdef USG +#ifdef __NetBSD__ +#define USE_TERMIOS +#include +#elif defined(USG) #include #else #include @@ -135,7 +138,10 @@ return putchar (c); } -#ifdef USG +#ifdef USE_TERMIOS +static struct termios sbuf; +static struct termios osbuf; +#elif defined(USG) static struct termio sbuf; static struct termio osbuf; #else @@ -263,8 +269,31 @@ #endif +#ifdef USE_TERMIOS + if (!isatty (0)) + { + (void) fprintf (stderr, TERM_C_NO_BATCH); + exit (1); + } + tcgetattr(0, &osbuf); + termchanged = 1; + + sbuf = osbuf; + sbuf.c_lflag &= ~(ECHO | ECHOK | ECHONL | ICANON); + sbuf.c_oflag &= ~(OPOST); + sbuf.c_iflag &= ~(INLCR | IGNCR | ICRNL); + sbuf.c_lflag |= ISIG; + sbuf.c_cc[VMIN] = 1; + sbuf.c_cc[VTIME] = 0; + tcsetattr(0, TCSANOW, &sbuf); + + uerasechar = osbuf.c_cc[VERASE]; + ukillchar = osbuf.c_cc[VKILL]; + +#endif + #ifdef SIGTSTP -#ifndef USG +#if !(defined(USG) || defined(USE_TERMIOS)) (void) sigsetmask (1<<(SIGTSTP-1) | 1<<(SIGTTIN-1) | 1<<(SIGTTOU-1)); #endif #endif @@ -290,7 +319,7 @@ #endif #endif -#ifndef USG +#if !(defined(USG) || defined(USE_TERMIOS)) (void) ioctl (0, TIOCGETP, (char *) &osbuf); #ifdef TIOCGLTC (void) ioctl (0, TIOCGLTC, (char *) &oltc); @@ -343,7 +372,9 @@ { if (te) tputs (te, 1, putch); -#ifdef USG +#ifdef USE_TERMIOS + tcsetattr(0, TCSANOW, &osbuf); +#elif defined(USG) (void) ioctl (0, TCSETAW, (char *) &osbuf); #else (void) ioctl (0, TIOCSETP, (char *) &osbuf); @@ -359,7 +390,9 @@ static SIGNAL_TYPE onstop (signo) int signo; { -#ifdef USG +#ifdef USE_TERMIOS + tcsetattr(0, TCSANOW, &osbuf); +#elif defined(USG) (void) ioctl (0, TCSETAW, (char *) &osbuf); #else (void) ioctl (0, TIOCSETP, (char *) &osbuf); @@ -374,7 +407,9 @@ (void) kill (0, signo); /* stop here until continued */ (void) signal (signo, onstop); -#ifdef USG +#ifdef USE_TERMIOS + tcsetattr(0, TCSANOW, &sbuf); +#elif defined(USG) (void) ioctl (0, TCSETAW, (char *) &sbuf); #else (void) ioctl (0, TIOCSETP, (char *) &sbuf); @@ -434,7 +469,9 @@ } argv[i] = NULL; -#ifdef USG +#ifdef USE_TERMIOS + tcsetattr(0, TCSANOW, &osbuf); +#elif defined(USG) (void) ioctl (0, TCSETAW, (char *) &osbuf); #else (void) ioctl (0, TIOCSETP, (char *) &osbuf); @@ -480,7 +517,9 @@ (void) signal (SIGTSTP, onstop); #endif -#ifdef USG +#ifdef USE_TERMIOS + tcsetattr(0, TCSANOW, &sbuf); +#elif defined(USG) (void) ioctl (0, TCSETAW, (char *) &sbuf); #else (void) ioctl (0, TIOCSETP, (char *) &sbuf); @@ -513,7 +552,9 @@ int ch; #endif -#ifdef USG +#ifdef USE_TERMIOS + tcsetattr(0, TCSANOW, &osbuf); +#elif defined(USG) (void) ioctl (0, TCSETAW, (char *) &osbuf); #else (void) ioctl (0, TIOCSETP, (char *) &osbuf); @@ -545,7 +586,9 @@ (void) signal (SIGTSTP, onstop); #endif -#ifdef USG +#ifdef USE_TERMIOS + tcsetattr(0, TCSANOW, &sbuf); +#elif defined(USG) (void) ioctl (0, TCSETAW, (char *) &sbuf); #else (void) ioctl (0, TIOCSETP, (char *) &sbuf);