version 1.4, 1998/04/28 22:13:26 |
version 1.5, 1998/08/18 04:02:14 |
|
|
#include <termios.h> |
#include <termios.h> |
#include <unistd.h> |
#include <unistd.h> |
|
|
/* |
/* |
* Set up curses, catch the appropriate signals, |
* Set up curses, catch the appropriate signals, |
* and build the various windows. |
* and build the various windows. |
*/ |
*/ |
void |
void |
init_display() |
init_display() |
{ |
{ |
struct sigvec sigv; |
struct sigaction sa; |
|
|
if (initscr() == NULL) |
if (initscr() == NULL) |
errx(1, "Terminal type unset or lacking necessary features."); |
errx(1, "Terminal type unset or lacking necessary features."); |
(void) sigvec(SIGTSTP, (struct sigvec *)0, &sigv); |
(void) sigaction(SIGTSTP, NULL, &sa); |
sigv.sv_mask |= sigmask(SIGALRM); |
sigaddset(&sa.sa_mask, SIGALRM); |
(void) sigvec(SIGTSTP, &sigv, (struct sigvec *)0); |
(void) sigaction(SIGTSTP, &sa, NULL); |
curses_initialized = 1; |
curses_initialized = 1; |
clear(); |
clear(); |
refresh(); |
refresh(); |
|
|
wclear(his_win.x_win); |
wclear(his_win.x_win); |
|
|
line_win = newwin(1, COLS, my_win.x_nlines, 0); |
line_win = newwin(1, COLS, my_win.x_nlines, 0); |
#ifdef NCURSES_VERSION |
#if defined(NCURSES_VERSION) || defined(whline) |
whline(line_win, '-', COLS); |
whline(line_win, '-', COLS); |
#else |
#else |
box(line_win, '-', '-'); |
box(line_win, '-', '-'); |
|
|
struct termios tty; |
struct termios tty; |
|
|
tcgetattr(0, &tty); |
tcgetattr(0, &tty); |
my_win.cerase = tty.c_cc[VERASE]; |
buf[0] = my_win.cerase = tty.c_cc[VERASE] == (u_char)_POSIX_VDISABLE |
my_win.kill = tty.c_cc[VKILL]; |
? CERASE : tty.c_cc[VERASE]; |
if (tty.c_cc[VWERASE] == (unsigned char) -1) |
buf[1] = my_win.kill = tty.c_cc[VKILL] == (u_char)_POSIX_VDISABLE |
my_win.werase = '\027'; /* control W */ |
? CKILL : tty.c_cc[CKILL]; |
else |
buf[2] = my_win.werase = tty.c_cc[VWERASE] == (u_char)_POSIX_VDISABLE |
my_win.werase = tty.c_cc[VWERASE]; |
? CWERASE : tty.c_cc[VWERASE]; |
buf[0] = my_win.cerase; |
|
buf[1] = my_win.kill; |
|
buf[2] = my_win.werase; |
|
cc = write(sockt, buf, sizeof(buf)); |
cc = write(sockt, buf, sizeof(buf)); |
if (cc != sizeof(buf) ) |
if (cc != sizeof(buf) ) |
p_error("Lost the connection"); |
p_error("Lost the connection"); |