about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-05-07 12:10:16 +0100
committerPeter Stephenson <pws@zsh.org>2015-05-07 12:10:16 +0100
commit60c6bcdeae6d132c0ab770cc8491055b24f7670e (patch)
treec9c6999eda40f0df916b7e20002e0da10341b231 /Src
parent13c6d38e4b989a7185a161d3978dd5cfd3da143f (diff)
downloadzsh-60c6bcdeae6d132c0ab770cc8491055b24f7670e.tar.gz
zsh-60c6bcdeae6d132c0ab770cc8491055b24f7670e.tar.xz
zsh-60c6bcdeae6d132c0ab770cc8491055b24f7670e.zip
35054: readonly -p + POSIXBUILTINS fix.
Now displays unset variables marekd readonly
Diffstat (limited to 'Src')
-rw-r--r--Src/params.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Src/params.c b/Src/params.c
index d53b6ca7e..9eab51a34 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -5039,8 +5039,19 @@ printparamnode(HashNode hn, int printflags)
     Param p = (Param) hn;
     char *t, **u;
 
-    if (p->node.flags & PM_UNSET)
-	return;
+    if (p->node.flags & PM_UNSET) {
+	if (isset(POSIXBUILTINS) && (p->node.flags & PM_READONLY) &&
+	    (printflags & PRINT_TYPESET))
+	{
+	    /*
+	     * Special POSIX rules: show the parameter as readonly
+	     * even though it's unset, but with no value.
+	     */
+	    printflags |= PRINT_NAMEONLY;
+	}
+	else
+	    return;
+    }
 
     if (printflags & PRINT_TYPESET)
 	printf("typeset ");