about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-09-13 19:59:13 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-09-13 19:59:13 +0000
commitb8a36eea87836c8156e4d3d587cb57252e02c7a2 (patch)
treeb14787450931a0dd4008a39db358f73204e11a5f /Src/builtin.c
parent6b68cc95c7448201d11b87004715fd8e8cd6543e (diff)
downloadzsh-b8a36eea87836c8156e4d3d587cb57252e02c7a2.tar.gz
zsh-b8a36eea87836c8156e4d3d587cb57252e02c7a2.tar.xz
zsh-b8a36eea87836c8156e4d3d587cb57252e02c7a2.zip
25662: declare -p should never create arguments
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 8adc7fcb1..8246453f4 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2473,10 +2473,17 @@ bin_typeset(char *name, char **argv, Options ops, int func)
 
     /* Take arguments literally.  Don't glob */
     while ((asg = getasg(*argv++))) {
-	if (!typeset_single(name, asg->name,
-			    (Param) (paramtab == realparamtab ?
-				     gethashnode2(paramtab, asg->name) :
-				     paramtab->getnode(paramtab, asg->name)),
+	HashNode hn = (paramtab == realparamtab ?
+		       gethashnode2(paramtab, asg->name) :
+		       paramtab->getnode(paramtab, asg->name));
+	if (OPT_ISSET(ops,'p')) {
+	    if (hn)
+		printparamnode(hn, printflags);
+	    else
+		zwarnnam(name, "no such variable: %s", asg->name);
+	    continue;
+	}
+	if (!typeset_single(name, asg->name, (Param)hn,
 			    func, on, off, roff, asg->value, NULL,
 			    ops, 0))
 	    returnval = 1;