Deleted Added
full compact
init_disp.c (14443) init_disp.c (17676)
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

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

35static char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94";
36#endif /* not lint */
37
38/*
39 * Initialization code for the display package,
40 * as well as the signal handling routines.
41 */
42
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

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

35static char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94";
36#endif /* not lint */
37
38/*
39 * Initialization code for the display package,
40 * as well as the signal handling routines.
41 */
42
43#include <sys/ioctl.h>
44#include <sys/ioctl_compat.h>
45#include <sys/types.h>
46#include <sys/stat.h>
43#include <sys/types.h>
44#include <sys/stat.h>
45#include <sys/termios.h>
46#include <sys/ttydefaults.h>
47
48#include <unistd.h>
49#include <signal.h>
50#include <err.h>
51#include "talk.h"
52
53/*
54 * Make sure the callee can write to the screen

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

69
70/*
71 * Set up curses, catch the appropriate signals,
72 * and build the various windows.
73 */
74void
75init_display()
76{
47
48#include <unistd.h>
49#include <signal.h>
50#include <err.h>
51#include "talk.h"
52
53/*
54 * Make sure the callee can write to the screen

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

69
70/*
71 * Set up curses, catch the appropriate signals,
72 * and build the various windows.
73 */
74void
75init_display()
76{
77 struct sigvec sigv;
77 struct sigaction sa;
78 int i;
78
79 if (initscr() == NULL)
80 errx(1, "Terminal type unset or lacking necessary features.");
79
80 if (initscr() == NULL)
81 errx(1, "Terminal type unset or lacking necessary features.");
81 (void) sigvec(SIGTSTP, (struct sigvec *)0, &sigv);
82 sigv.sv_mask |= sigmask(SIGALRM);
83 (void) sigvec(SIGTSTP, &sigv, (struct sigvec *)0);
82 (void) sigaction(SIGTSTP, (struct sigaction *)0, &sa);
83 sigaddset(&sa.sa_mask, SIGALRM);
84 (void) sigaction(SIGTSTP, &sa, (struct sigaction *)0);
84 curses_initialized = 1;
85 clear();
86 refresh();
87 noecho();
88 crmode();
89 signal(SIGINT, sig_sent);
90 signal(SIGPIPE, sig_sent);
91 /* curses takes care of ^Z */

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

98 his_win.x_nlines = LINES / 2 - 1;
99 his_win.x_ncols = COLS;
100 his_win.x_win = newwin(his_win.x_nlines, his_win.x_ncols,
101 my_win.x_nlines+1, 0);
102 scrollok(his_win.x_win, TRUE);
103 wclear(his_win.x_win);
104
105 line_win = newwin(1, COLS, my_win.x_nlines, 0);
85 curses_initialized = 1;
86 clear();
87 refresh();
88 noecho();
89 crmode();
90 signal(SIGINT, sig_sent);
91 signal(SIGPIPE, sig_sent);
92 /* curses takes care of ^Z */

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

99 his_win.x_nlines = LINES / 2 - 1;
100 his_win.x_ncols = COLS;
101 his_win.x_win = newwin(his_win.x_nlines, his_win.x_ncols,
102 my_win.x_nlines+1, 0);
103 scrollok(his_win.x_win, TRUE);
104 wclear(his_win.x_win);
105
106 line_win = newwin(1, COLS, my_win.x_nlines, 0);
106 box(line_win, '-', '-');
107 for (i = 0; i < COLS; i++)
108 mvwaddch(line_win, 0, i, '-');
107 wrefresh(line_win);
108 /* let them know we are working on it */
109 current_state = "No connection yet";
110}
111
112/*
113 * Trade edit characters with the other talk. By agreement
114 * the first three characters each talk transmits after
115 * connection are the three edit characters.
116 */
117void
118set_edit_chars()
119{
120 char buf[3];
121 int cc;
109 wrefresh(line_win);
110 /* let them know we are working on it */
111 current_state = "No connection yet";
112}
113
114/*
115 * Trade edit characters with the other talk. By agreement
116 * the first three characters each talk transmits after
117 * connection are the three edit characters.
118 */
119void
120set_edit_chars()
121{
122 char buf[3];
123 int cc;
122 struct sgttyb tty;
123 struct ltchars ltc;
124 struct termios tio;
124
125
125 ioctl(0, TIOCGETP, &tty);
126 ioctl(0, TIOCGLTC, (struct sgttyb *)&ltc);
127 my_win.cerase = tty.sg_erase;
128 my_win.kill = tty.sg_kill;
129 if (ltc.t_werasc == (char) -1)
130 my_win.werase = '\027'; /* control W */
131 else
132 my_win.werase = ltc.t_werasc;
126 tcgetattr(0, &tio);
127 my_win.cerase = tio.c_cc[VERASE];
128 my_win.kill = tio.c_cc[VKILL];
129 my_win.werase = tio.c_cc[VWERASE];
130 if (my_win.cerase == (char)_POSIX_VDISABLE)
131 my_win.kill = CERASE;
132 if (my_win.kill == (char)_POSIX_VDISABLE)
133 my_win.kill = CKILL;
134 if (my_win.werase == (char)_POSIX_VDISABLE)
135 my_win.werase = CWERASE;
133 buf[0] = my_win.cerase;
134 buf[1] = my_win.kill;
135 buf[2] = my_win.werase;
136 cc = write(sockt, buf, sizeof(buf));
137 if (cc != sizeof(buf) )
138 p_error("Lost the connection");
139 cc = read(sockt, buf, sizeof(buf));
140 if (cc != sizeof(buf) )

--- 33 unchanged lines hidden ---
136 buf[0] = my_win.cerase;
137 buf[1] = my_win.kill;
138 buf[2] = my_win.werase;
139 cc = write(sockt, buf, sizeof(buf));
140 if (cc != sizeof(buf) )
141 p_error("Lost the connection");
142 cc = read(sockt, buf, sizeof(buf));
143 if (cc != sizeof(buf) )

--- 33 unchanged lines hidden ---