diff options
author | 1996-08-27 22:38:23 +0000 | |
---|---|---|
committer | 1996-08-27 22:38:23 +0000 | |
commit | df3c1d5ed855004aa03c9406ea200eacabd6539c (patch) | |
tree | 4d3bcdff52974b3848e96262be0518229c8a7db8 | |
parent | Fix race condition. (diff) | |
download | wireguard-openbsd-df3c1d5ed855004aa03c9406ea200eacabd6539c.tar.xz wireguard-openbsd-df3c1d5ed855004aa03c9406ea200eacabd6539c.zip |
vis
-rw-r--r-- | usr.bin/finger/lprint.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c index 8890fda62ce..22c37176acb 100644 --- a/usr.bin/finger/lprint.c +++ b/usr.bin/finger/lprint.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lprint.c,v 1.2 1996/06/26 05:33:17 deraadt Exp $ */ +/* $OpenBSD: lprint.c,v 1.3 1996/08/27 22:38:23 deraadt Exp $ */ /* * Copyright (c) 1989 The Regents of the University of California. @@ -38,7 +38,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)lprint.c 5.13 (Berkeley) 10/31/90";*/ -static char rcsid[] = "$OpenBSD: lprint.c,v 1.2 1996/06/26 05:33:17 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: lprint.c,v 1.3 1996/08/27 22:38:23 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -50,6 +50,7 @@ static char rcsid[] = "$OpenBSD: lprint.c,v 1.2 1996/06/26 05:33:17 deraadt Exp #include <string.h> #include <ctype.h> #include <paths.h> +#include <vis.h> #include "finger.h" #define LINE_LEN 80 @@ -280,19 +281,10 @@ show_text(directory, file_name, header) vputc(ch) register int ch; { - int meta; + char visout[4], *s2; - if (!isascii(ch)) { - (void)putchar('M'); - (void)putchar('-'); - ch = toascii(ch); - meta = 1; - } else - meta = 0; - if (isprint(ch) || !meta && (ch == ' ' || ch == '\t' || ch == '\n')) - (void)putchar(ch); - else { - (void)putchar('^'); - (void)putchar(ch == '\177' ? '?' : ch | 0100); - } + ch = toascii(ch); + vis(visout, ch, VIS_SAFE|VIS_NOSLASH, 0); + for (s2 = visout; *s2; s2++) + (void)putchar(*s2); } |