summaryrefslogtreecommitdiff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-06-12 10:34:57 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-06-12 10:34:57 +0000
commitc26704f7a37f615820cebeacb763aa2748c290ec (patch)
tree0194a4aa367c7062578a90ca6dd00a8a7e253a83 /Src/subst.c
parentae09302120db6252c50d9a3d4ba07960ee6a81b8 (diff)
downloadzsh-c26704f7a37f615820cebeacb763aa2748c290ec.tar.gz
zsh-c26704f7a37f615820cebeacb763aa2748c290ec.zip
Added KSH_TYPESET option.
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 25eda1cee..b5480d75e 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -50,6 +50,7 @@ mod_export void
prefork(LinkList list, int flags)
{
LinkNode node;
+ int asssub = (flags & PF_TYPESET) && isset(KSHTYPESET);
queue_signals();
for (node = firstnode(list); node; incnode(node)) {
@@ -70,7 +71,7 @@ prefork(LinkList list, int flags)
if (isset(SHFILEEXPANSION))
filesub((char **)getaddrdata(node),
flags & (PF_TYPESET|PF_ASSIGN));
- if (!(node = stringsubst(list, node, flags & PF_SINGLE))) {
+ if (!(node = stringsubst(list, node, flags & PF_SINGLE, asssub))) {
unqueue_signals();
return;
}
@@ -97,7 +98,7 @@ prefork(LinkList list, int flags)
/**/
static LinkNode
-stringsubst(LinkList list, LinkNode node, int ssub)
+stringsubst(LinkList list, LinkNode node, int ssub, int asssub)
{
int qt;
char *str3 = (char *)getdata(node);
@@ -211,6 +212,12 @@ stringsubst(LinkList list, LinkNode node, int ssub)
str3 = str2;
setdata(node, str3);
continue;
+ } else if (asssub && ((c == '=') || c == Equals) && str != str3) {
+ /*
+ * We are in a normal argument which looks like an assignment
+ * and is to be treated like one, with no word splitting.
+ */
+ ssub = 1;
}
str++;
}
@@ -1885,7 +1892,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
*--fstr = Marker;
init_list1(tl, fstr);
- if (!eval && !stringsubst(&tl, firstnode(&tl), ssub))
+ if (!eval && !stringsubst(&tl, firstnode(&tl), ssub, 0))
return NULL;
*str = aptr;
tn = firstnode(&tl);