summaryrefslogtreecommitdiff
path: root/usr.bin/write/write.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-11-17 12:39:21 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-11-17 12:39:21 +0000
commit679d3934fc583ba23a2e23dfcd681e41dceb8317 (patch)
tree8bb00edaedccd954114eea5488d68cbebdc98246 /usr.bin/write/write.c
parent7db130be2bc286e264d56e8117270e14a1ded88f (diff)
handle meta characters; good security idea from freebsd
Diffstat (limited to 'usr.bin/write/write.c')
-rw-r--r--usr.bin/write/write.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c
index 3dc298f8cd1..00d5e169e2e 100644
--- a/usr.bin/write/write.c
+++ b/usr.bin/write/write.c
@@ -304,12 +304,17 @@ wr_fputs(s)
c = toascii(*s);
if (c == '\n') {
PUTC('\r');
- PUTC('\n');
} else if (!isprint(c) && !isspace(c) && c != '\007') {
- PUTC('^');
- PUTC(c^0x40); /* DEL to ?, others to alpha */
- } else
- PUTC(c);
+ if (c & 0x80) {
+ PUTC('M');
+ PUTC('-');
+ c &= ~0x80;
+ } else {
+ PUTC('^');
+ c &= ~0x40;
+ }
+ }
+ PUTC(c);
}
return;