Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/unvis Add -h to decode RFC 1808 URI style encoding (...



details:   https://anonhg.NetBSD.org/src/rev/34e6d906bbf9
branches:  trunk
changeset: 565873:34e6d906bbf9
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Apr 22 06:55:15 2004 +0000

description:
Add -h to decode RFC 1808 URI style encoding (VIS_HTTPSTYLE).

diffstat:

 usr.bin/unvis/unvis.1 |  12 ++++++++++--
 usr.bin/unvis/unvis.c |  17 +++++++++++------
 2 files changed, 21 insertions(+), 8 deletions(-)

diffs (101 lines):

diff -r d1f5bec0660d -r 34e6d906bbf9 usr.bin/unvis/unvis.1
--- a/usr.bin/unvis/unvis.1     Thu Apr 22 06:53:43 2004 +0000
+++ b/usr.bin/unvis/unvis.1     Thu Apr 22 06:55:15 2004 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: unvis.1,v 1.6 2003/08/07 11:16:56 agc Exp $
+.\"    $NetBSD: unvis.1,v 1.7 2004/04/22 06:55:15 lukem Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)unvis.1    8.1 (Berkeley) 6/6/93
 .\"
-.Dd June 6, 1993
+.Dd April 22, 2004
 .Dt UNVIS 1
 .Os
 .Sh NAME
@@ -37,6 +37,7 @@
 .Nd "revert a visual representation of data back to original form"
 .Sh SYNOPSIS
 .Nm
+.Op Fl h
 .Op Ar file ...
 .Sh DESCRIPTION
 .Nm
@@ -44,6 +45,13 @@
 .Xr vis 1 .
 It reverts
 a visual representation of data back to its original form on standard output.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl h
+Decode using the URI encoding from RFC 1808.
+.Pq Dv VIS_HTTPSTYLE
+.El
 .Sh SEE ALSO
 .Xr vis 1 ,
 .Xr unvis 3 ,
diff -r d1f5bec0660d -r 34e6d906bbf9 usr.bin/unvis/unvis.c
--- a/usr.bin/unvis/unvis.c     Thu Apr 22 06:53:43 2004 +0000
+++ b/usr.bin/unvis/unvis.c     Thu Apr 22 06:55:15 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: unvis.c,v 1.9 2003/08/07 11:16:56 agc Exp $    */
+/*     $NetBSD: unvis.c,v 1.10 2004/04/22 06:55:15 lukem Exp $ */
 
 /*-
  * Copyright (c) 1989, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)unvis.c    8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: unvis.c,v 1.9 2003/08/07 11:16:56 agc Exp $");
+__RCSID("$NetBSD: unvis.c,v 1.10 2004/04/22 06:55:15 lukem Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -48,6 +48,8 @@
 #include <unistd.h>
 #include <vis.h>
 
+int eflags;
+
 int    main __P((int, char **));
 void process __P((FILE *fp, const char *filename));
 
@@ -59,11 +61,14 @@
        FILE *fp;
        int ch;
 
-       while ((ch = getopt(argc, argv, "")) != -1)
+       while ((ch = getopt(argc, argv, "h")) != -1)
                switch((char)ch) {
+               case 'h':
+                       eflags |= VIS_HTTPSTYLE;
+                       break;
                case '?':
                default:
-                       (void) fprintf(stderr, "usage: unvis [file...]\n");
+                       (void) fprintf(stderr, "usage: unvis [-h] [file...]\n");
                        exit(1);
                }
        argc -= optind;
@@ -94,7 +99,7 @@
        while ((c = getc(fp)) != EOF) {
                offset++;
        again:
-               switch(ret = unvis(&outc, (char)c, &state, 0)) {
+               switch(ret = unvis(&outc, (char)c, &state, eflags)) {
                case UNVIS_VALID:
                        putchar(outc);
                        break;
@@ -113,6 +118,6 @@
                        /* NOTREACHED */
                }
        }
-       if (unvis(&outc, (char)0, &state, UNVIS_END) == UNVIS_VALID)
+       if (unvis(&outc, (char)0, &state, eflags | UNVIS_END) == UNVIS_VALID)
                putchar(outc);
 }



Home | Main Index | Thread Index | Old Index