Deleted Added
full compact
init_disp.c (128445) init_disp.c (178642)
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35
36__FBSDID("$FreeBSD: head/usr.bin/talk/init_disp.c 128445 2004-04-19 21:37:29Z cognet $");
36__FBSDID("$FreeBSD: head/usr.bin/talk/init_disp.c 178642 2008-04-28 21:08:42Z delphij $");
37
38#ifndef lint
39static const char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94";
40#endif
41
42/*
43 * Initialization code for the display package,
44 * as well as the signal handling routines.

--- 10 unchanged lines hidden (view full) ---

55#include "talk.h"
56
57extern volatile sig_atomic_t gotwinch;
58
59/*
60 * Make sure the callee can write to the screen
61 */
62void
37
38#ifndef lint
39static const char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94";
40#endif
41
42/*
43 * Initialization code for the display package,
44 * as well as the signal handling routines.

--- 10 unchanged lines hidden (view full) ---

55#include "talk.h"
56
57extern volatile sig_atomic_t gotwinch;
58
59/*
60 * Make sure the callee can write to the screen
61 */
62void
63check_writeable()
63check_writeable(void)
64{
65 char *tty;
66 struct stat sb;
67
68 if ((tty = ttyname(STDERR_FILENO)) == NULL)
69 err(1, "ttyname");
70 if (stat(tty, &sb) < 0)
71 err(1, "%s", tty);
72 if (!(sb.st_mode & S_IWGRP))
73 errx(1, "The callee cannot write to this terminal, use \"mesg y\".");
74}
75
76/*
77 * Set up curses, catch the appropriate signals,
78 * and build the various windows.
79 */
80void
64{
65 char *tty;
66 struct stat sb;
67
68 if ((tty = ttyname(STDERR_FILENO)) == NULL)
69 err(1, "ttyname");
70 if (stat(tty, &sb) < 0)
71 err(1, "%s", tty);
72 if (!(sb.st_mode & S_IWGRP))
73 errx(1, "The callee cannot write to this terminal, use \"mesg y\".");
74}
75
76/*
77 * Set up curses, catch the appropriate signals,
78 * and build the various windows.
79 */
80void
81init_display()
81init_display(void)
82{
83 struct sigaction sa;
84
85 if (initscr() == NULL)
86 errx(1, "Terminal type unset or lacking necessary features.");
87 (void) sigaction(SIGTSTP, (struct sigaction *)0, &sa);
88 sigaddset(&sa.sa_mask, SIGALRM);
89 (void) sigaction(SIGTSTP, &sa, (struct sigaction *)0);

--- 33 unchanged lines hidden (view full) ---

123}
124
125/*
126 * Trade edit characters with the other talk. By agreement
127 * the first three characters each talk transmits after
128 * connection are the three edit characters.
129 */
130void
82{
83 struct sigaction sa;
84
85 if (initscr() == NULL)
86 errx(1, "Terminal type unset or lacking necessary features.");
87 (void) sigaction(SIGTSTP, (struct sigaction *)0, &sa);
88 sigaddset(&sa.sa_mask, SIGALRM);
89 (void) sigaction(SIGTSTP, &sa, (struct sigaction *)0);

--- 33 unchanged lines hidden (view full) ---

123}
124
125/*
126 * Trade edit characters with the other talk. By agreement
127 * the first three characters each talk transmits after
128 * connection are the three edit characters.
129 */
130void
131set_edit_chars()
131set_edit_chars(void)
132{
133 char buf[3];
134 int cc;
135 struct termios tio;
136
137 tcgetattr(0, &tio);
138 my_win.cerase = tio.c_cc[VERASE];
139 my_win.kill = tio.c_cc[VKILL];

--- 15 unchanged lines hidden (view full) ---

155 p_error("Lost the connection");
156 his_win.cerase = buf[0];
157 his_win.kill = buf[1];
158 his_win.werase = buf[2];
159}
160
161/* ARGSUSED */
162void
132{
133 char buf[3];
134 int cc;
135 struct termios tio;
136
137 tcgetattr(0, &tio);
138 my_win.cerase = tio.c_cc[VERASE];
139 my_win.kill = tio.c_cc[VKILL];

--- 15 unchanged lines hidden (view full) ---

155 p_error("Lost the connection");
156 his_win.cerase = buf[0];
157 his_win.kill = buf[1];
158 his_win.werase = buf[2];
159}
160
161/* ARGSUSED */
162void
163sig_sent(signo)
164 int signo __unused;
163sig_sent(int signo __unused)
165{
166
167 message("Connection closing. Exiting");
168 quit();
169}
170
171void
164{
165
166 message("Connection closing. Exiting");
167 quit();
168}
169
170void
172sig_winch(int dummy)
171sig_winch(int dummy __unused)
173{
174
175 gotwinch = 1;
176}
177
178/*
179 * All done talking...hang up the phone and reset terminal thingy's
180 */
181void
172{
173
174 gotwinch = 1;
175}
176
177/*
178 * All done talking...hang up the phone and reset terminal thingy's
179 */
180void
182quit()
181quit(void)
183{
184
185 if (curses_initialized) {
186 wmove(his_win.x_win, his_win.x_nlines-1, 0);
187 wclrtoeol(his_win.x_win);
188 wrefresh(his_win.x_win);
189 endwin();
190 }

--- 50 unchanged lines hidden ---
182{
183
184 if (curses_initialized) {
185 wmove(his_win.x_win, his_win.x_nlines-1, 0);
186 wclrtoeol(his_win.x_win);
187 wrefresh(his_win.x_win);
188 endwin();
189 }

--- 50 unchanged lines hidden ---