diff options
| author | christos <christos@NetBSD.org> | 2014-09-26 01:21:07 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2014-09-26 01:21:07 +0000 |
| commit | 2e73bb3f331088d6eacb1d50bb44121c7adbb9ef (patch) | |
| tree | 41689dea33209a34907c3600b2dc8c8e654ca69d /usr.bin/vis | |
| parent | 911916a201b9a21fb3a9d9b4c346286adcb2953d (diff) | |
add VIS_META/VIS_SHELL support to encode all shell metacharacters.
XXX: /etc/rc.d/wizd fix $
Diffstat (limited to 'usr.bin/vis')
| -rw-r--r-- | usr.bin/vis/vis.1 | 15 | ||||
| -rw-r--r-- | usr.bin/vis/vis.c | 14 |
2 files changed, 22 insertions, 7 deletions
diff --git a/usr.bin/vis/vis.1 b/usr.bin/vis/vis.1 index fcaa7fbc39d..3ea80e1e859 100644 --- a/usr.bin/vis/vis.1 +++ b/usr.bin/vis/vis.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: vis.1,v 1.20 2013/10/29 12:27:23 njoly Exp $ +.\" $NetBSD: vis.1,v 1.21 2014/09/26 01:21:07 christos Exp $ .\" .\" Copyright (c) 1989, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)vis.1 8.4 (Berkeley) 4/19/94 .\" -.Dd February 19, 2013 +.Dd September 25, 2014 .Dt VIS 1 .Os .Sh NAME @@ -37,7 +37,7 @@ .Nd display non-printable characters in a visual format .Sh SYNOPSIS .Nm -.Op Fl bcfhlmnostw +.Op Fl bcfhlmMnosStw .Op Fl e Ar extra .Op Fl F Ar foldwidth .Op Ar file ... @@ -102,6 +102,12 @@ followed by the newline. .It Fl m Encode using the MIME Quoted-Printable encoding from RFC 2045. .Pq Dv VIS_MIMESTYLE +.It Fl M +Encode all shell meta characters (implies +.Fl S , +.Fl w , +.Fl g ) +.Pq Dv VIS_META .It Fl n Turns off any encoding, except for the fact that backslashes are still doubled and hidden newline sequences inserted if @@ -128,6 +134,9 @@ Only characters considered unsafe to send to a terminal are encoded. This flag allows backspace, bell, and carriage return in addition to the default space, tab and newline. .Pq Dv VIS_SAFE +.It Fl S +Encode shell meta-characters that are non-white space or glob. +.Pq Dv VIS_SHELL .It Fl t Tabs are also encoded. .Pq Dv VIS_TAB diff --git a/usr.bin/vis/vis.c b/usr.bin/vis/vis.c index 1509c81c412..f359dbf962e 100644 --- a/usr.bin/vis/vis.c +++ b/usr.bin/vis/vis.c @@ -1,4 +1,4 @@ -/* $NetBSD: vis.c,v 1.22 2013/02/20 17:04:45 christos Exp $ */ +/* $NetBSD: vis.c,v 1.23 2014/09/26 01:21:07 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\ #if 0 static char sccsid[] = "@(#)vis.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: vis.c,v 1.22 2013/02/20 17:04:45 christos Exp $"); +__RCSID("$NetBSD: vis.c,v 1.23 2014/09/26 01:21:07 christos Exp $"); #endif /* not lint */ #include <stdio.h> @@ -70,7 +70,7 @@ main(int argc, char *argv[]) int ch; int rval; - while ((ch = getopt(argc, argv, "bcde:F:fhlmnostw")) != -1) + while ((ch = getopt(argc, argv, "bcde:F:fhlmMnosStw")) != -1) switch((char)ch) { case 'b': eflags |= VIS_NOSLASH; @@ -107,6 +107,9 @@ main(int argc, char *argv[]) if (foldwidth == 80) foldwidth = 76; break; + case 'M': + eflags |= VIS_META; + break; case 'n': none++; break; @@ -116,6 +119,9 @@ main(int argc, char *argv[]) case 's': eflags |= VIS_SAFE; break; + case 'S': + eflags |= VIS_SHELL; + break; case 't': eflags |= VIS_TAB; break; @@ -125,7 +131,7 @@ main(int argc, char *argv[]) case '?': default: (void)fprintf(stderr, - "Usage: %s [-bcfhlmnostw] [-e extra]" + "Usage: %s [-bcfhlmMnosStw] [-e extra]" " [-F foldwidth] [file ...]\n", getprogname()); return 1; } |
