/* * term.c - deal with termcap, and unix terminal mode settings * * Pace Willisson, 1983 */ #include #ifdef USG #include #else #include #endif #include #include "ispell.h" int putch(); erase () { if (cl) tputs(cl, li, putch); else { if (ho) tputs(ho, 100, putch); else if (cm) tputs(tgoto(cm, 0, 0), 100, putch); tputs(cd, li, putch); } } move (row, col) { tputs (tgoto (cm, col, row), 100, putch); } inverse () { tputs (so, 10, putch); } normal () { tputs (se, 10, putch); } backup () { if (BC) tputs (BC, 1, putch); else putchar ('\b'); } putch (c) { putchar (c); } #ifdef USG struct termio sbuf, osbuf; #else struct sgttyb sbuf, osbuf; #endif static termchanged = 0; terminit () { int done(); #ifdef USG if (!isatty(0)) { fprintf (stderr, "Can't deal with non interactive use yet.\n"); exit (1); } (void) ioctl (0, TCGETA, &osbuf); termchanged = 1; sbuf = osbuf; sbuf.c_lflag &= ~(ECHO | ECHOK | ECHONL | ICANON); sbuf.c_oflag &= ~(OPOST); sbuf.c_iflag &= ~(INLCR | IGNCR | ICRNL); sbuf.c_cc[VMIN] = 1; sbuf.c_cc[VTIME] = 1; (void) ioctl (0, TCSETAW, &sbuf); erasechar = osbuf.c_cc[VERASE]; killchar = osbuf.c_cc[VKILL]; (void) signal (SIGINT, done); #else int tpgrp; int onstop(); extern short ospeed; retry: (void) sigsetmask(1<