Import vis(1) from NetBSD as of 20210621
This commit is contained in:
parent
584d8a41f5
commit
04751ecc44
43
vis.1
43
vis.1
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: vis.1,v 1.19 2013/03/14 19:17:23 njoly Exp $
|
||||
.\" $NetBSD: vis.1,v 1.25 2021/02/20 09:31:51 nia 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 February 18, 2021
|
||||
.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 bcfhlMmNnoSstw
|
||||
.Op Fl e Ar extra
|
||||
.Op Fl F Ar foldwidth
|
||||
.Op Ar file ...
|
||||
@ -99,9 +99,22 @@ Encode using the URI encoding from RFC 1808.
|
||||
Mark newlines with the visible sequence
|
||||
.Ql \e$ ,
|
||||
followed by the newline.
|
||||
.It Fl M
|
||||
Encode all shell meta characters (implies
|
||||
.Fl S ,
|
||||
.Fl w ,
|
||||
.Fl g )
|
||||
.Pq Dv VIS_META
|
||||
.It Fl m
|
||||
Encode using the MIME Quoted-Printable encoding from RFC 2045.
|
||||
.Pq Dv VIS_MIMESTYLE
|
||||
.It Fl N
|
||||
Turn on the
|
||||
.Dv VIS_NOLOCALE
|
||||
flag which encodes using the
|
||||
.Dq C
|
||||
locale, removing any encoding dependencies caused by the current
|
||||
locale settings specified in the environment.
|
||||
.It Fl n
|
||||
Turns off any encoding, except for the fact that backslashes are
|
||||
still doubled and hidden newline sequences inserted if
|
||||
@ -123,6 +136,9 @@ That is, the output can be unfolded by running the output through
|
||||
Request a format which displays non-printable characters as
|
||||
an octal number, \eddd.
|
||||
.Pq Dv VIS_OCTAL
|
||||
.It Fl S
|
||||
Encode shell meta-characters that are non-white space or glob.
|
||||
.Pq Dv VIS_SHELL
|
||||
.It Fl s
|
||||
Only characters considered unsafe to send to a terminal are encoded.
|
||||
This flag allows backspace, bell, and carriage return in addition
|
||||
@ -155,6 +171,25 @@ instead.
|
||||
Specify the locale of the input data.
|
||||
Set to C if the input data locale is unknown.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Visualize characters encoding white spaces and tabs:
|
||||
.Bd -literal -offset indent
|
||||
$ printf "\\x10\\n\\t\\n" | vis -w -t
|
||||
\\^P\\012\\011\\012
|
||||
.Ed
|
||||
.Pp
|
||||
Same as above but using `\\$' for newline followed by an actual newline:
|
||||
.Bd -literal -offset indent
|
||||
$ printf "\\x10\\n\\t\\n" | vis -w -t -l
|
||||
\\^P\\$
|
||||
\\011\\$
|
||||
.Ed
|
||||
.Pp
|
||||
Visualize string using URI encoding:
|
||||
.Bd -literal -offset indent
|
||||
$ printf https://www.NetBSD.org | vis -h
|
||||
https%3a%2f%2fwww.NetBSD.org
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr unvis 1 ,
|
||||
.Xr svis 3 ,
|
||||
@ -164,7 +199,7 @@ The
|
||||
.Nm
|
||||
command appears in
|
||||
.Bx 4.4 .
|
||||
Myltibyte character support was added in
|
||||
Multibyte character support was added in
|
||||
.Nx 7.0
|
||||
and
|
||||
.Fx 9.2 .
|
||||
|
17
vis.c
17
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.25 2015/05/24 19:42:39 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.25 2015/05/24 19:42:39 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:fhlMmNnoSstw")) != -1)
|
||||
switch((char)ch) {
|
||||
case 'b':
|
||||
eflags |= VIS_NOSLASH;
|
||||
@ -102,17 +102,26 @@ main(int argc, char *argv[])
|
||||
case 'l':
|
||||
markeol++; /* mark end of line with \$ */
|
||||
break;
|
||||
case 'M':
|
||||
eflags |= VIS_META;
|
||||
break;
|
||||
case 'm':
|
||||
eflags |= VIS_MIMESTYLE;
|
||||
if (foldwidth == 80)
|
||||
foldwidth = 76;
|
||||
break;
|
||||
case 'N':
|
||||
eflags |= VIS_NOLOCALE;
|
||||
break;
|
||||
case 'n':
|
||||
none++;
|
||||
break;
|
||||
case 'o':
|
||||
eflags |= VIS_OCTAL;
|
||||
break;
|
||||
case 'S':
|
||||
eflags |= VIS_SHELL;
|
||||
break;
|
||||
case 's':
|
||||
eflags |= VIS_SAFE;
|
||||
break;
|
||||
@ -125,7 +134,7 @@ main(int argc, char *argv[])
|
||||
case '?':
|
||||
default:
|
||||
(void)fprintf(stderr,
|
||||
"Usage: %s [-bcfhlmnostw] [-e extra]"
|
||||
"Usage: %s [-bcfhlMmNnoSstw] [-e extra]"
|
||||
" [-F foldwidth] [file ...]\n", getprogname());
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user