diff options
| author | christos <christos@NetBSD.org> | 2008-12-21 17:15:09 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2008-12-21 17:15:09 +0000 |
| commit | 271febebf6a3fd4cbf8f19ea5ebeeceaaa1eefe3 (patch) | |
| tree | a3d02fc1bec1142ebb2fa569f4dac591baa2d373 | |
| parent | 8025a0b1ce32ba4d2c817eced4103848b291c80d (diff) | |
use EXP_CASE only when trimming and unquoted.
| -rw-r--r-- | bin/sh/expand.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/bin/sh/expand.c b/bin/sh/expand.c index 60d13f5ed76..75845a379ab 100644 --- a/bin/sh/expand.c +++ b/bin/sh/expand.c @@ -1,4 +1,4 @@ -/* $NetBSD: expand.c,v 1.80 2008/12/20 20:36:44 christos Exp $ */ +/* $NetBSD: expand.c,v 1.81 2008/12/21 17:15:09 christos 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.80 2008/12/20 20:36:44 christos Exp $"); +__RCSID("$NetBSD: expand.c,v 1.81 2008/12/21 17:15:09 christos Exp $"); #endif #endif /* not lint */ @@ -493,10 +493,21 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varfla int c = 0; int saveherefd = herefd; struct nodelist *saveargbackq = argbackq; - int amount; + int amount, how; herefd = -1; - argstr(p, EXP_CASE); + switch (subtype) { + case VSTRIMLEFT: + case VSTRIMLEFTMAX: + case VSTRIMRIGHT: + case VSTRIMRIGHTMAX: + how = (varflags & VSQUOTE) ? 0 : EXP_CASE; + break; + default: + how = 0; + break; + } + argstr(p, how); STACKSTRNUL(expdest); herefd = saveherefd; argbackq = saveargbackq; |
