mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
typeset -p: fix output of nonexistent [0]= array element (#451)
This fix was backported from ksh 93v- 2012-10-04. src/cmd/ksh93/sh/nvtree.c: nv_outnode(): - If the array is supposed to be empty, do not continue. This avoids outputting a nonexistent [0]= element for empty arrays. Resolves: https://github.com/ksh93/ksh/issues/420 Co-authored-by: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
parent
fb696ecfae
commit
a8dd1bbd9d
4 changed files with 38 additions and 2 deletions
|
|
@ -556,9 +556,11 @@ void nv_outnode(Namval_t *np, Sfio_t* out, int indent, int special)
|
|||
Indent = indent;
|
||||
if(ap)
|
||||
{
|
||||
sfputc(out,'(');
|
||||
if(array_elem(ap)==0)
|
||||
return;
|
||||
if(!(ap->nelem&ARRAY_SCAN))
|
||||
nv_putsub(np,NIL(char*),ARRAY_SCAN);
|
||||
sfputc(out,'(');
|
||||
if(indent>=0)
|
||||
{
|
||||
sfputc(out,'\n');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue