4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1994 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
40 #pragma ident "%Z%%M% %I% %E% SMI"
43 * init_disp contains the initialization code for the display package,
44 * as well as the signal handling routines
52 #define signal(s, f) sigset(s, f)
55 static void sig_sent();
58 * set up curses, catch the appropriate signals, and build the
66 curses_initialized
= 1;
74 signal(SIGINT
, sig_sent
);
75 signal(SIGPIPE
, sig_sent
);
77 /* curses takes care of ^Z */
79 my_win
.x_nlines
= LINES
/ 2;
80 my_win
.x_ncols
= COLS
;
81 my_win
.x_win
= newwin(my_win
.x_nlines
, my_win
.x_ncols
, 0, 0);
82 scrollok(my_win
.x_win
, FALSE
);
85 rem_win
.x_nlines
= LINES
/ 2 - 1;
86 rem_win
.x_ncols
= COLS
;
87 rem_win
.x_win
= newwin(rem_win
.x_nlines
, rem_win
.x_ncols
,
88 my_win
.x_nlines
+1, 0);
89 scrollok(rem_win
.x_win
, FALSE
);
90 wclear(rem_win
.x_win
);
92 line_win
= newwin(1, COLS
, my_win
.x_nlines
, 0);
93 box(line_win
, '-', '-');
96 /* let them know we are working on it */
98 current_state
= gettext("No connection yet");
102 * trade edit characters with the other talk. By agreement
103 * the first three characters each talk transmits after
104 * connection are the three edit characters
114 ioctl(0, TCGETS
, (struct termios
*)&tty
);
116 buf
[0] = my_win
.cerase
= tty
.c_cc
[VERASE
];
117 /* for SVID should be VERSE */
118 buf
[1] = my_win
.kill
= tty
.c_cc
[VKILL
];
119 buf
[2] = my_win
.werase
= tty
.c_cc
[VWERASE
];
120 /* for SVID should be VWERSE */
127 ioctl(0, TIOCGLTC
, (struct sgttyb
*)<c
);
129 my_win
.cerase
= tty
.sg_erase
;
130 my_win
.kill
= tty
.sg_kill
;
132 if (ltc
.t_werasc
== (char)-1) {
133 my_win
.werase
= '\027'; /* control W */
135 my_win
.werase
= ltc
.t_werasc
;
138 buf
[0] = my_win
.cerase
;
139 buf
[1] = my_win
.kill
;
140 buf
[2] = my_win
.werase
;
143 cc
= write(sockt
, buf
, sizeof (buf
));
145 if (cc
!= sizeof (buf
)) {
146 p_error(gettext("Lost the connection"));
149 cc
= read(sockt
, buf
, sizeof (buf
));
151 if (cc
!= sizeof (buf
)) {
152 p_error(gettext("Lost the connection"));
155 rem_win
.cerase
= buf
[0];
156 rem_win
.kill
= buf
[1];
157 rem_win
.werase
= buf
[2];
163 message(gettext("Connection closing. Exiting"));
168 * All done talking...hang up the phone and reset terminal thingy's
174 if (curses_initialized
) {
175 wmove(rem_win
.x_win
, rem_win
.x_nlines
-1, 0);
176 wclrtoeol(rem_win
.x_win
);
177 wrefresh(rem_win
.x_win
);
181 if (invitation_waiting
) {