Source-Changes-HG archive

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

[src/netbsd-3]: src/usr.bin/vi/ex Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/5fe55bfd2018
branches:  netbsd-3
changeset: 577138:5fe55bfd2018
user:      tron <tron%NetBSD.org@localhost>
date:      Fri Sep 09 15:00:58 2005 +0000

description:
Pull up following revision(s) (requested by aymeric in ticket #753):
        usr.bin/vi/ex/ex_argv.c: revision 1.13
>From code inspection, nvi had the undocumented and non-working functionality
of ignoring alphanumerical and blank characters from the shellmeta option.
The former code was using a character pointed to by a pointer as a boolean
to check whether to enable this functionality, but in the meantime the pointer
was used for something else. Introduce a variable for this boolean so that
the functionality actually works.

diffstat:

 usr.bin/vi/ex/ex_argv.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r 618e6773e827 -r 5fe55bfd2018 usr.bin/vi/ex/ex_argv.c
--- a/usr.bin/vi/ex/ex_argv.c   Fri Sep 09 14:25:47 2005 +0000
+++ b/usr.bin/vi/ex/ex_argv.c   Fri Sep 09 15:00:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ex_argv.c,v 1.12 2005/02/12 12:53:22 aymeric Exp $     */
+/*     $NetBSD: ex_argv.c,v 1.12.2.1 2005/09/09 15:00:58 tron Exp $    */
 
 /*-
  * Copyright (c) 1993, 1994
@@ -16,7 +16,7 @@
 #if 0
 static const char sccsid[] = "@(#)ex_argv.c    10.26 (Berkeley) 9/20/96";
 #else
-__RCSID("$NetBSD: ex_argv.c,v 1.12 2005/02/12 12:53:22 aymeric Exp $");
+__RCSID("$NetBSD: ex_argv.c,v 1.12.2.1 2005/09/09 15:00:58 tron Exp $");
 #endif
 #endif /* not lint */
 
@@ -151,6 +151,7 @@
        size_t blen, len, n;
        int rval;
        char *bp, *mp, *p;
+       int shellmeta_ok;
 
        GET_SPACE_RET(sp, bp, blen, 512);
 
@@ -190,12 +191,16 @@
        if (opts_empty(sp, O_SHELL, 1) || opts_empty(sp, O_SHELLMETA, 1))
                n = 0;
        else {
+               shellmeta_ok = 1;
                for (p = mp = O_STR(sp, O_SHELLMETA); *p != '\0'; ++p)
-                       if (isblank(*p) || isalnum((unsigned char)*p))
+                       if (isblank(*p) || isalnum((unsigned char)*p)) {
+                               shellmeta_ok = 0;
                                break;
+                       }
+
                p = bp + SHELLOFFSET;
                n = len - SHELLOFFSET;
-               if (*p != '\0') {
+               if (shellmeta_ok) {
                        for (; n > 0; --n, ++p)
                                if (strchr(mp, *p) != NULL)
                                        break;



Home | Main Index | Thread Index | Old Index