FreeBSD/usr.bin/talk/init_disp.c
/*
 * Set up curses, catch the appropriate signals,
 * and build the various windows.
 */
Set up curses, catch the appropriate signals,
and build the various windows.
Set up curses catch the appropriate signals and build the various windows .
void
init_display(void)
{
	struct sigaction sa;
	if (initscr() == NULL)
		errx(1, "Terminal type unset or lacking necessary features.");
	(void) sigaction(SIGTSTP, (struct sigaction *)0, &sa);
	sigaddset(&sa.sa_mask, SIGALRM);
	(void) sigaction(SIGTSTP, &sa, (struct sigaction *)0);
	curses_initialized = 1;
	clear();
	refresh();
	noecho();
	crmode();
	signal(SIGINT, sig_sent);
	signal(SIGPIPE, sig_sent);
	signal(SIGWINCH, sig_winch);
	my_win.x_nlines = LINES / 2;
	my_win.x_ncols = COLS;
	my_win.x_win = newwin(my_win.x_nlines, my_win.x_ncols, 0, 0);
	idlok(my_win.x_win, TRUE);
	scrollok(my_win.x_win, TRUE);
	wclear(my_win.x_win);
	his_win.x_nlines = LINES / 2 - 1;
	his_win.x_ncols = COLS;
	his_win.x_win = newwin(his_win.x_nlines, his_win.x_ncols,
	    my_win.x_nlines+1, 0);
	idlok(my_win.x_win, TRUE);
	scrollok(his_win.x_win, TRUE);
	wclear(his_win.x_win);
	line_win = newwin(1, COLS, my_win.x_nlines, 0);
#if defined(hline) || defined(whline) || defined(NCURSES_VERSION)
	whline(line_win, 0, COLS);
#else
	box(line_win, '-', '-');
#endif
	wrefresh(line_win);
	current_state = "No connection yet";
}
void init_display ( void ) { struct sigaction sa ; if ( initscr ( ) == NULL ) errx ( 1 , " " ) ; ( void ) sigaction ( SIGTSTP , ( struct sigaction * ) 0 , & sa ) ; sigaddset ( & sa . sa_mask , SIGALRM ) ; ( void ) sigaction ( SIGTSTP , & sa , ( struct sigaction * ) 0 ) ; curses_initialized = 1 ; clear ( ) ; refresh ( ) ; noecho ( ) ; crmode ( ) ; signal ( SIGINT , sig_sent ) ; signal ( SIGPIPE , sig_sent ) ; signal ( SIGWINCH , sig_winch ) ; my_win . x_nlines = LINES / 2 ; my_win . x_ncols = COLS ; my_win . x_win = newwin ( my_win . x_nlines , my_win . x_ncols , 0 , 0 ) ; idlok ( my_win . x_win , TRUE ) ; scrollok ( my_win . x_win , TRUE ) ; wclear ( my_win . x_win ) ; his_win . x_nlines = LINES / 2 - 1 ; his_win . x_ncols = COLS ; his_win . x_win = newwin ( his_win . x_nlines , his_win . x_ncols , my_win . x_nlines + 1 , 0 ) ; idlok ( my_win . x_win , TRUE ) ; scrollok ( his_win . x_win , TRUE ) ; wclear ( his_win . x_win ) ; line_win = newwin ( 1 , COLS , my_win . x_nlines , 0 ) ; #if defined ( hline ) || defined ( whline ) || defined ( NCURSES_VERSION ) whline ( line_win , 0 , COLS ) ; #else box ( line_win , ' ' , ' ' ) ; #endif wrefresh ( line_win ) ; current_state = " " ; }
Set up curses, catch the appropriate signals,
 and build the various windows.
Set up curses catch the appropriate signals and build the various windows .
/* curses takes care of ^Z */ /* let them know we are working on it */