diff options
author | ache <ache@FreeBSD.org> | 1997-04-08 13:52:53 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1997-04-08 13:52:53 +0000 |
commit | e71376d20484fc71295968ada48afcc4066676eb (patch) | |
tree | ab299d8d245be4e66df9ea4e35e26378361c47f4 /usr.bin/wall | |
parent | 2bd0c6c536511e5c9f2c9fcc442b41f3665cef7a (diff) | |
download | FreeBSD-src-e71376d20484fc71295968ada48afcc4066676eb.zip FreeBSD-src-e71376d20484fc71295968ada48afcc4066676eb.tar.gz |
Fix 8bit chars handling
Diffstat (limited to 'usr.bin/wall')
-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 8bef548..4351888 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 |