summaryrefslogtreecommitdiff
path: root/usr.bin/wall
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1997-04-08 13:52:53 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1997-04-08 13:52:53 +0000
commitfc092135ab7ccebbc46b397659dd0b6a50267ead (patch)
treef9468902f1ef92d97d27fa81ffb9be223760e97f /usr.bin/wall
parentcbd13fcada3b332025fbd1e489a2466ff2d19e59 (diff)
Notes
Diffstat (limited to 'usr.bin/wall')
-rw-r--r--usr.bin/wall/wall.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/wall/wall.c b/usr.bin/wall/wall.c
index 8bef548d2c6f..4351888c9c4f 100644
--- a/usr.bin/wall/wall.c
+++ b/usr.bin/wall/wall.c
@@ -124,7 +124,8 @@ void
makemsg(fname)
char *fname;
{
- register int ch, cnt;
+ register int cnt;
+ register unsigned char ch;
struct tm *lt;
struct passwd *pw;
struct stat sbuf;
@@ -172,13 +173,21 @@ makemsg(fname)
}
while (fgets(lbuf, sizeof(lbuf), stdin))
for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) {
+ again:
if (cnt == 79 || ch == '\n') {
for (; cnt < 79; ++cnt)
putc(' ', fp);
putc('\r', fp);
putc('\n', fp);
cnt = 0;
- } else if (!isprint(ch) && !isspace(ch) && ch != '\007') {
+ } else if ( !isprint(ch) && !isspace(ch)
+ && ch != '\007' && ch != '\010'
+ ) {
+ if (ch & 0x80) {
+ ch &= 0x7F;
+ (void)fprintf(fp, "M-");
+ goto again;
+ }
putc('^', fp);
putc(ch^0x40, fp); /* DEL to ?, others to alpha */
} else