diff --git a/check.t b/check.t index 081cf82..cfdbc99 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.337 2009/11/09 23:35:07 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.338 2009/11/21 22:29:12 tg Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ @@ -5249,6 +5249,18 @@ expected-stdout: c we d we --- +name: varexpand-null-1 +description: + Ensure empty strings expand emptily +stdin: + print x ${a} ${b} y + print z ${a#?} ${b%?} w + print v ${a=} ${b/c/d} u +expected-stdout: + x y + z w + v u +--- name: print-funny-chars description: Check print builtin's capability to output designated characters diff --git a/eval.c b/eval.c index 31ef823..928fec3 100644 --- a/eval.c +++ b/eval.c @@ -22,7 +22,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.70 2009/10/30 00:57:37 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.71 2009/11/21 22:29:11 tg Exp $"); /* * string expansion @@ -591,7 +591,7 @@ expand(const char *cp, /* input word */ */ x.str = trimsub(str_val(st->var), dp, st->stype); - type = XSUB; + type = strlen(x.str) ? XSUB : XNULLSUB; if (f&DOBLANK) doblank++; st = st->prev;