ksh/ksh93-zerofill.dif
2012-10-19 15:22:56 +00:00

30 lines
846 B
Plaintext

--- src/cmd/ksh93/bltins/typeset.c
+++ src/cmd/ksh93/bltins/typeset.c 2012-10-19 16:56:48.561818559 +0200
@@ -746,6 +746,7 @@
}
if (tp->aflag == '-')
{
+ int oldnum;
if((flag&NV_EXPORT) && (strchr(name,'.') || nv_isvtree(np)))
errormsg(SH_DICT,ERROR_exit(1),e_badexport,name);
#if SHOPT_BSH
@@ -764,6 +765,9 @@
else if(!(flag&NV_LJUST))
newflag &= ~NV_LJUST;
}
+ oldnum = nv_size(np);
+ if (oldnum > 0)
+ tp->argnum = oldnum;
}
else
{
@@ -1222,7 +1226,7 @@
if(shp->subshell)
np=sh_assignok(np,0);
}
- if(!nv_isnull(np))
+ if(!nv_isnull(np) || nv_size(np) || nv_isattr(np,~(NV_MINIMAL|NV_NOFREE)))
_nv_unset(np,0);
if(troot==shp->var_tree && shp->st.real_fun && (dp=shp->var_tree->walk) && dp==shp->st.real_fun->sdict)
nv_delete(np,dp,NV_NOFREE);