summaryrefslogtreecommitdiffstats
path: root/usr.bin/talk
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-08-19 19:42:00 +0000
committerpeter <peter@FreeBSD.org>1996-08-19 19:42:00 +0000
commitc663bae3b71b62dea313426b5c2729c15e305f38 (patch)
tree897e8fc17dd2ef81d46fc360d75d518c6b770ee6 /usr.bin/talk
parent52457c88af4b55e2d3987cc4fbb0fdf89b1d080d (diff)
downloadFreeBSD-src-c663bae3b71b62dea313426b5c2729c15e305f38.zip
FreeBSD-src-c663bae3b71b62dea313426b5c2729c15e305f38.tar.gz
Update some ancient warts in talk:
- use termios, not sgtty - dont use _putchar(), that was a BSD-curses specific feature not in other curses packages (such as ncurses) - use sigaction, not sigvec while I'm there - box() does different things under sysv/ncurses on 1-line high windows, and BSD-curses doesn't have hline(), so do it by adding characters instead. That works on both styles of curses.
Diffstat (limited to 'usr.bin/talk')
-rw-r--r--usr.bin/talk/display.c2
-rw-r--r--usr.bin/talk/init_disp.c39
-rw-r--r--usr.bin/talk/io.c4
3 files changed, 25 insertions, 20 deletions
diff --git a/usr.bin/talk/display.c b/usr.bin/talk/display.c
index aabb581..7b43d46 100644
--- a/usr.bin/talk/display.c
+++ b/usr.bin/talk/display.c
@@ -142,7 +142,7 @@ display(win, text, size)
continue;
}
if (*text == '\7') {
- _putchar(*text);
+ write(STDOUT_FILENO, text, 1);
text++;
continue;
}
diff --git a/usr.bin/talk/init_disp.c b/usr.bin/talk/init_disp.c
index bfcfd94..14f0e02 100644
--- a/usr.bin/talk/init_disp.c
+++ b/usr.bin/talk/init_disp.c
@@ -40,10 +40,10 @@ static char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94";
* as well as the signal handling routines.
*/
-#include <sys/ioctl.h>
-#include <sys/ioctl_compat.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/termios.h>
+#include <sys/ttydefaults.h>
#include <unistd.h>
#include <signal.h>
@@ -74,13 +74,14 @@ check_writeable()
void
init_display()
{
- struct sigvec sigv;
+ struct sigaction sa;
+ int i;
if (initscr() == NULL)
errx(1, "Terminal type unset or lacking necessary features.");
- (void) sigvec(SIGTSTP, (struct sigvec *)0, &sigv);
- sigv.sv_mask |= sigmask(SIGALRM);
- (void) sigvec(SIGTSTP, &sigv, (struct sigvec *)0);
+ (void) sigaction(SIGTSTP, (struct sigaction *)0, &sa);
+ sigaddset(&sa.sa_mask, SIGALRM);
+ (void) sigaction(SIGTSTP, &sa, (struct sigaction *)0);
curses_initialized = 1;
clear();
refresh();
@@ -103,7 +104,8 @@ init_display()
wclear(his_win.x_win);
line_win = newwin(1, COLS, my_win.x_nlines, 0);
- box(line_win, '-', '-');
+ for (i = 0; i < COLS; i++)
+ mvwaddch(line_win, 0, i, '-');
wrefresh(line_win);
/* let them know we are working on it */
current_state = "No connection yet";
@@ -119,17 +121,18 @@ set_edit_chars()
{
char buf[3];
int cc;
- struct sgttyb tty;
- struct ltchars ltc;
-
- ioctl(0, TIOCGETP, &tty);
- ioctl(0, TIOCGLTC, (struct sgttyb *)&ltc);
- my_win.cerase = tty.sg_erase;
- my_win.kill = tty.sg_kill;
- if (ltc.t_werasc == (char) -1)
- my_win.werase = '\027'; /* control W */
- else
- my_win.werase = ltc.t_werasc;
+ struct termios tio;
+
+ tcgetattr(0, &tio);
+ my_win.cerase = tio.c_cc[VERASE];
+ my_win.kill = tio.c_cc[VKILL];
+ my_win.werase = tio.c_cc[VWERASE];
+ if (my_win.cerase == (char)_POSIX_VDISABLE)
+ my_win.kill = CERASE;
+ if (my_win.kill == (char)_POSIX_VDISABLE)
+ my_win.kill = CKILL;
+ if (my_win.werase == (char)_POSIX_VDISABLE)
+ my_win.werase = CWERASE;
buf[0] = my_win.cerase;
buf[1] = my_win.kill;
buf[2] = my_win.werase;
diff --git a/usr.bin/talk/io.c b/usr.bin/talk/io.c
index f608654..7b8ead8 100644
--- a/usr.bin/talk/io.c
+++ b/usr.bin/talk/io.c
@@ -61,7 +61,9 @@ talk()
char buf[BUFSIZ];
struct timeval wait;
- message("Connection established\007\007\007");
+ message("Connection established");
+ write(STDOUT_FILENO, "\007\007\007", 3);
+
current_line = 0;
/*
OpenPOWER on IntegriCloud