fix 'typeset -p' to act according to TFM and ksh93

This commit is contained in:
tg 2006-11-19 17:13:36 +00:00
parent b21875f20f
commit 8a4b64fde3
1 changed files with 3 additions and 5 deletions

View File

@ -5,7 +5,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.37 2006/11/12 14:58:14 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.38 2006/11/19 17:13:36 tg Exp $");
int int
c_cd(char **wp) c_cd(char **wp)
@ -583,7 +583,7 @@ c_typeset(char **wp)
* here for compatibility with ksh93. * here for compatibility with ksh93.
*/ */
pflag = 1; pflag = 1;
break; continue;
case 'r': case 'r':
flag = RDONLY; flag = RDONLY;
break; break;
@ -768,9 +768,7 @@ c_typeset(char **wp)
break; break;
} else { } else {
if (pflag) if (pflag)
shprintf("%s ", shprintf("typeset ");
(flag & EXPORT) ?
"export" : "readonly");
if ((vp->flag&ARRAY) && any_set) if ((vp->flag&ARRAY) && any_set)
shprintf("%s[%d]", shprintf("%s[%d]",
vp->name, vp->index); vp->name, vp->index);