summaryrefslogtreecommitdiffstats
path: root/usr.bin/talk/init_disp.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-08-19 19:42:00 +0000
committerpeter <peter@FreeBSD.org>1996-08-19 19:42:00 +0000
commitc663bae3b71b62dea313426b5c2729c15e305f38 (patch)
tree897e8fc17dd2ef81d46fc360d75d518c6b770ee6 /usr.bin/talk/init_disp.c
parent52457c88af4b55e2d3987cc4fbb0fdf89b1d080d (diff)
downloadFreeBSD-src-c663bae3b71b62dea313426b5c2729c15e305f38.zip
FreeBSD-src-c663bae3b71b62dea313426b5c2729c15e305f38.tar.gz
Update some ancient warts in talk:
- use termios, not sgtty - dont use _putchar(), that was a BSD-curses specific feature not in other curses packages (such as ncurses) - use sigaction, not sigvec while I'm there - box() does different things under sysv/ncurses on 1-line high windows, and BSD-curses doesn't have hline(), so do it by adding characters instead. That works on both styles of curses.
Diffstat (limited to 'usr.bin/talk/init_disp.c')
-rw-r--r--usr.bin/talk/init_disp.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/usr.bin/talk/init_disp.c b/usr.bin/talk/init_disp.c
index bfcfd94..14f0e02 100644
--- a/usr.bin/talk/init_disp.c
+++ b/usr.bin/talk/init_disp.c
@@ -40,10 +40,10 @@ static char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94";
* as well as the signal handling routines.
*/
-#include <sys/ioctl.h>
-#include <sys/ioctl_compat.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/termios.h>
+#include <sys/ttydefaults.h>
#include <unistd.h>
#include <signal.h>
@@ -74,13 +74,14 @@ check_writeable()
void
init_display()
{
- struct sigvec sigv;
+ struct sigaction sa;
+ int i;
if (initscr() == NULL)
errx(1, "Terminal type unset or lacking necessary features.");
- (void) sigvec(SIGTSTP, (struct sigvec *)0, &sigv);
- sigv.sv_mask |= sigmask(SIGALRM);
- (void) sigvec(SIGTSTP, &sigv, (struct sigvec *)0);
+ (void) sigaction(SIGTSTP, (struct sigaction *)0, &sa);
+ sigaddset(&sa.sa_mask, SIGALRM);
+ (void) sigaction(SIGTSTP, &sa, (struct sigaction *)0);
curses_initialized = 1;
clear();
refresh();
@@ -103,7 +104,8 @@ init_display()
wclear(his_win.x_win);
line_win = newwin(1, COLS, my_win.x_nlines, 0);
- box(line_win, '-', '-');
+ for (i = 0; i < COLS; i++)
+ mvwaddch(line_win, 0, i, '-');
wrefresh(line_win);
/* let them know we are working on it */
current_state = "No connection yet";
@@ -119,17 +121,18 @@ set_edit_chars()
{
char buf[3];
int cc;
- struct sgttyb tty;
- struct ltchars ltc;
-
- ioctl(0, TIOCGETP, &tty);
- ioctl(0, TIOCGLTC, (struct sgttyb *)&ltc);
- my_win.cerase = tty.sg_erase;
- my_win.kill = tty.sg_kill;
- if (ltc.t_werasc == (char) -1)
- my_win.werase = '\027'; /* control W */
- else
- my_win.werase = ltc.t_werasc;
+ struct termios tio;
+
+ tcgetattr(0, &tio);
+ my_win.cerase = tio.c_cc[VERASE];
+ my_win.kill = tio.c_cc[VKILL];
+ my_win.werase = tio.c_cc[VWERASE];
+ if (my_win.cerase == (char)_POSIX_VDISABLE)
+ my_win.kill = CERASE;
+ if (my_win.kill == (char)_POSIX_VDISABLE)
+ my_win.kill = CKILL;
+ if (my_win.werase == (char)_POSIX_VDISABLE)
+ my_win.werase = CWERASE;
buf[0] = my_win.cerase;
buf[1] = my_win.kill;
buf[2] = my_win.werase;
OpenPOWER on IntegriCloud