diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 1997-04-08 13:52:53 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 1997-04-08 13:52:53 +0000 |
| commit | fc092135ab7ccebbc46b397659dd0b6a50267ead (patch) | |
| tree | f9468902f1ef92d97d27fa81ffb9be223760e97f | |
| parent | cbd13fcada3b332025fbd1e489a2466ff2d19e59 (diff) | |
Notes
| -rw-r--r-- | usr.bin/wall/wall.c | 13 |
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 |
