bugfix: ${x#?} should expand to nothing not '' if x was unset
This commit is contained in:
parent
ba9375684d
commit
d02e6be6cf
14
check.t
14
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: 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: 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 $
|
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||||
@ -5249,6 +5249,18 @@ expected-stdout:
|
|||||||
c we
|
c we
|
||||||
d 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
|
name: print-funny-chars
|
||||||
description:
|
description:
|
||||||
Check print builtin's capability to output designated characters
|
Check print builtin's capability to output designated characters
|
||||||
|
4
eval.c
4
eval.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#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
|
* string expansion
|
||||||
@ -591,7 +591,7 @@ expand(const char *cp, /* input word */
|
|||||||
*/
|
*/
|
||||||
x.str = trimsub(str_val(st->var),
|
x.str = trimsub(str_val(st->var),
|
||||||
dp, st->stype);
|
dp, st->stype);
|
||||||
type = XSUB;
|
type = strlen(x.str) ? XSUB : XNULLSUB;
|
||||||
if (f&DOBLANK)
|
if (f&DOBLANK)
|
||||||
doblank++;
|
doblank++;
|
||||||
st = st->prev;
|
st = st->prev;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user