Source-Changes-HG archive

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

[src/trunk]: src/bin/sh Fix 'set "*" b; case "* b" in "$@") ...' and 'set "*"...



details:   https://anonhg.NetBSD.org/src/rev/89693e22c4e3
branches:  trunk
changeset: 552246:89693e22c4e3
user:      dsl <dsl%NetBSD.org@localhost>
date:      Mon Sep 22 12:17:24 2003 +0000

description:
Fix 'set "*" b; case "* b" in "$@") ...' and 'set "*"; case 1 in "${#1}") ...'
Which got broken by the previous fix.

diffstat:

 bin/sh/expand.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (64 lines):

diff -r 3bea2a0f0a4c -r 89693e22c4e3 bin/sh/expand.c
--- a/bin/sh/expand.c   Mon Sep 22 06:01:43 2003 +0000
+++ b/bin/sh/expand.c   Mon Sep 22 12:17:24 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: expand.c,v 1.58 2003/09/17 16:01:19 christos Exp $     */
+/*     $NetBSD: expand.c,v 1.59 2003/09/22 12:17:24 dsl Exp $  */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c   8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.58 2003/09/17 16:01:19 christos Exp $");
+__RCSID("$NetBSD: expand.c,v 1.59 2003/09/22 12:17:24 dsl Exp $");
 #endif
 #endif /* not lint */
 
@@ -98,7 +98,7 @@
 STATIC int subevalvar(char *, char *, int, int, int, int);
 STATIC char *evalvar(char *, int);
 STATIC int varisset(char *, int);
-STATIC void varvalue(char *, int, int);
+STATIC void varvalue(char *, int, int, int);
 STATIC void recordregion(int, int, int);
 STATIC void removerecordregions(int); 
 STATIC void ifsbreakup(char *, struct arglist *);
@@ -643,8 +643,7 @@
        if (set && subtype != VSPLUS) {
                /* insert the value of the variable */
                if (special) {
-                       varvalue(var, varflags & VSQUOTE,
-                           flag & (EXP_FULL|EXP_CASE));
+                       varvalue(var, varflags & VSQUOTE, subtype, flag);
                        if (subtype == VSLENGTH) {
                                varlen = expdest - stackblock() - startloc;
                                STADJUST(-varlen, expdest);
@@ -810,7 +809,7 @@
  */
 
 STATIC void
-varvalue(char *name, int quoted, int allow_split)
+varvalue(char *name, int quoted, int subtype, int flag)
 {
        int num;
        char *p;
@@ -821,7 +820,7 @@
 
 #define STRTODEST(p) \
        do {\
-       if (allow_split) { \
+       if (flag & (EXP_FULL | EXP_CASE) && subtype != VSLENGTH) { \
                syntax = quoted? DQSYNTAX : BASESYNTAX; \
                while (*p) { \
                        if (syntax[(int)*p] == CCTL) \
@@ -856,7 +855,7 @@
                }
                break;
        case '@':
-               if (allow_split && quoted) {
+               if (flag & EXP_FULL && quoted) {
                        for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
                                STRTODEST(p);
                                if (*ap)



Home | Main Index | Thread Index | Old Index