summaryrefslogtreecommitdiff
path: root/usr.bin/write/write.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-26 10:22:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-26 10:22:12 +0000
commitec60c7dd19aa387f7465259ca0496d5ffa94e2b5 (patch)
tree6a6fb10b2404cccd9e59a81223b4b3a6f5e1cfc7 /usr.bin/write/write.c
parentc29701a2497c9a9d3a7e90ccf85dbf74ba2e3979 (diff)
vis this baby too
Diffstat (limited to 'usr.bin/write/write.c')
-rw-r--r--usr.bin/write/write.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c
index 30bbb6753e7..0201c52d891 100644
--- a/usr.bin/write/write.c
+++ b/usr.bin/write/write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write.c,v 1.4 1996/06/26 05:44:00 deraadt Exp $ */
+/* $OpenBSD: write.c,v 1.5 1996/08/26 10:22:11 deraadt Exp $ */
/* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)write.c 8.2 (Berkeley) 4/27/95";
#endif
-static char *rcsid = "$OpenBSD: write.c,v 1.4 1996/06/26 05:44:00 deraadt Exp $";
+static char *rcsid = "$OpenBSD: write.c,v 1.5 1996/08/26 10:22:11 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -63,6 +63,7 @@ static char *rcsid = "$OpenBSD: write.c,v 1.4 1996/06/26 05:44:00 deraadt Exp $"
#include <unistd.h>
#include <utmp.h>
#include <err.h>
+#include <vis.h>
void done();
void do_write __P((char *, char *, uid_t));
@@ -297,7 +298,8 @@ void
wr_fputs(s)
register char *s;
{
- register char c;
+ register u_char c;
+ char visout[4], *s2;
#define PUTC(c) if (putchar(c) == EOF) goto err;
@@ -305,17 +307,12 @@ wr_fputs(s)
c = toascii(*s);
if (c == '\n') {
PUTC('\r');
- } else if (!isprint(c) && !isspace(c) && c != '\007') {
- if (c & 0x80) {
- PUTC('M');
- PUTC('-');
- c &= ~0x80;
- } else {
- PUTC('^');
- c &= ~0x40;
- }
+ PUTC('\n');
+ continue;
}
- PUTC(c);
+ vis(visout, c, VIS_SAFE, s[1]);
+ for (s2 = visout; *s2; s2++)
+ PUTC(*s2);
}
return;