From 9c2eac8f6e3c3653d7933cb10130bf85517b34b5 Mon Sep 17 00:00:00 2001 From: David Rhodus Date: Sun, 24 Aug 2003 15:51:45 +0000 Subject: [PATCH] Add function so Control-D erases the screen. Obtained from: FreeBSD --- usr.bin/talk/display.c | 28 ++++++++++++++++++++-------- usr.bin/talk/talk.1 | 24 +++++++++++++----------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/usr.bin/talk/display.c b/usr.bin/talk/display.c index 4d02ed5738..d4497cefe1 100644 --- a/usr.bin/talk/display.c +++ b/usr.bin/talk/display.c @@ -32,7 +32,7 @@ * * @(#)display.c 8.1 (Berkeley) 6/6/93 * $FreeBSD: src/usr.bin/talk/display.c,v 1.7 1999/08/28 01:06:11 peter Exp $ - * $DragonFly: src/usr.bin/talk/display.c,v 1.2 2003/06/17 04:29:32 dillon Exp $ + * $DragonFly: src/usr.bin/talk/display.c,v 1.3 2003/08/24 15:51:45 drhodus Exp $ */ /* @@ -50,7 +50,7 @@ int curses_initialized = 0; /* * max HAS to be a function, it is called with - * a argument of the form --foo at least once. + * an argument of the form --foo at least once. */ int max(a,b) @@ -66,11 +66,11 @@ max(a,b) */ void display(win, text, size) - register xwin_t *win; - register char *text; + xwin_t *win; + char *text; int size; { - register int i; + int i; char cch; for (i = 0; i < size; i++) { @@ -80,6 +80,18 @@ display(win, text, size) text++; continue; } + if (*text == 004 && win == &my_win) { + /* control-D clears the screen */ + werase(my_win.x_win); + getyx(my_win.x_win, my_win.x_line, my_win.x_col); + wrefresh(my_win.x_win); + werase(his_win.x_win); + getyx(his_win.x_win, his_win.x_line, his_win.x_col); + wrefresh(his_win.x_win); + text++; + continue; + } + /* erase character */ if ( *text == win->cerase || *text == 010 /* BS */ @@ -101,7 +113,7 @@ display(win, text, size) if ( *text == win->werase || *text == 027 /* ^W */ ) { - int endcol, xcol, i, c; + int endcol, xcol, ii, c; endcol = win->x_col; xcol = endcol - 1; @@ -118,7 +130,7 @@ display(win, text, size) xcol--; } wmove(win->x_win, win->x_line, xcol + 1); - for (i = xcol + 1; i < endcol; i++) + for (ii = xcol + 1; ii < endcol; ii++) waddch(win->x_win, ' '); wmove(win->x_win, win->x_line, xcol + 1); getyx(win->x_win, win->x_line, win->x_col); @@ -169,7 +181,7 @@ readwin(win, line, col) int col; { int oldline, oldcol; - register int c; + int c; getyx(win, oldline, oldcol); wmove(win, line, col); diff --git a/usr.bin/talk/talk.1 b/usr.bin/talk/talk.1 index b71ba80348..207f35bd0c 100644 --- a/usr.bin/talk/talk.1 +++ b/usr.bin/talk/talk.1 @@ -31,7 +31,7 @@ .\" .\" @(#)talk.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD: src/usr.bin/talk/talk.1,v 1.6.2.5 2002/07/15 07:57:15 keramida Exp $ -.\" $DragonFly: src/usr.bin/talk/talk.1,v 1.2 2003/06/17 04:29:32 dillon Exp $ +.\" $DragonFly: src/usr.bin/talk/talk.1,v 1.3 2003/08/24 15:51:45 drhodus Exp $ .\" .Dd June 6, 1993 .Dt TALK 1 @@ -97,7 +97,15 @@ in separate windows. Typing control-L .Ql ^L will cause the screen to -be reprinted, while your erase, kill, and word kill characters will +be reprinted. +Typing control-D +.Ql ^D +will clear both parts of your screen to be cleared, while +the control-D character will be sent to the remote side +(and just displayed by this +.Nm +client). +Your erase, kill, and word kill characters will behave normally. To exit, just type your interrupt character; .Nm @@ -108,13 +116,6 @@ Permission to talk may be denied or granted by use of the .Xr mesg 1 command. At the outset talking is allowed. -Certain commands, in -particular -.Xr nroff 1 -and -.Xr pr 1 , -disallow messages in order to -prevent messy output. .Sh FILES .Bl -tag -width /var/run/utmp -compact .It Pa /etc/hosts @@ -127,10 +128,11 @@ to find the recipient's tty .Xr mesg 1 , .Xr wall 1 , .Xr who 1 , -.Xr write 1 +.Xr write 1 , +.Xr talkd 8 .Sh BUGS The version of -.Xr talk 1 +.Nm released with .Bx 4.3 uses a protocol that -- 2.41.0