From 0b3d21702a3fe738c9c1a2938ef96881021f821e Mon Sep 17 00:00:00 2001 From: tg Date: Fri, 16 Dec 2011 20:03:12 +0000 Subject: [PATCH] fix ifs.sh; anonymous submission (mkt?), 10x --- eval.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/eval.c b/eval.c index fe8dea7..bb7c2ae 100644 --- a/eval.c +++ b/eval.c @@ -22,7 +22,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.110 2011/11/26 00:45:20 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.111 2011/12/16 20:03:12 tg Exp $"); /* * string expansion @@ -863,11 +863,19 @@ expand(const char *cp, /* input word */ fdo = 0; saw_eq = 0; tilde_ok = (f & (DOTILDE|DOASNTILDE)) ? 1 : 0; - if (c != 0) - Xinit(ds, dp, 128, ATEMP); - } - if (c == 0) + if (c == 0) + return; + Xinit(ds, dp, 128, ATEMP); + } else if (c == 0) { return; + } else if (type == XSUB && ctype(c, C_IFS) && + !ctype(c, C_IFSWS) && Xlength(ds, dp) == 0) { + char *p; + + *(p = alloc(1, ATEMP)) = '\0'; + XPput(*wp, p); + type = XSUBMID; + } if (word != IFS_NWS) word = ctype(c, C_IFSWS) ? IFS_WS : IFS_NWS; } else {