about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2024-03-12 18:02:38 -0700
committerBart Schaefer <schaefer@zsh.org>2024-03-12 18:02:38 -0700
commit8adfbfc1f05200d566b9830232d0dabf82c84283 (patch)
treed740be1472e8e7b1e0042afd43ddcf75aede8657 /Src
parent7c875adb0968b308e9b989ae5ac8d245b58810f2 (diff)
downloadzsh-8adfbfc1f05200d566b9830232d0dabf82c84283.tar.gz
zsh-8adfbfc1f05200d566b9830232d0dabf82c84283.tar.xz
zsh-8adfbfc1f05200d566b9830232d0dabf82c84283.zip
unposted: "typeset -p" has problems with special parameters having NULL values
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/ksh93.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/Src/Modules/ksh93.c b/Src/Modules/ksh93.c
index 8d10317dc..3206c11f3 100644
--- a/Src/Modules/ksh93.c
+++ b/Src/Modules/ksh93.c
@@ -102,9 +102,10 @@ static const struct gsu_scalar sh_name_gsu =
 static const struct gsu_scalar sh_subscript_gsu =
     { strvargetfn, nullstrsetfn, nullunsetfn };
 
-static char *sh_name;
-static char *sh_subscript;
-static char *sh_edchar;
+static char sh_unsetval[2];	/* Dummy to treat as NULL */
+static char *sh_name = sh_unsetval;
+static char *sh_subscript = sh_unsetval;
+static char *sh_edchar = sh_unsetval;
 static char sh_edmode[2];
 
 /*
@@ -193,7 +194,7 @@ ksh93_wrapper(Eprog prog, FuncWrap w, char *name)
 	    strcpy(sh_edmode, "\033");
 	else
 	    strcpy(sh_edmode, "");
-	if (!sh_edchar)
+	if (sh_edchar == sh_unsetval)
 	    sh_edchar = dupstring(getsparam("KEYS"));
 	if (varedarg) {
 	    char *ie = itype_end((sh_name = dupstring(varedarg)), INAMESPC, 0);
@@ -204,16 +205,16 @@ ksh93_wrapper(Eprog prog, FuncWrap w, char *name)
 		ie = sh_subscript + strlen(sh_subscript);
 		*--ie = '\0';
 	    } else
-		sh_subscript = NULL;
+		sh_subscript = sh_unsetval;
 	    if ((pm = createparam(".sh.value", LOCAL_NAMEREF))) {
 		pm->level = locallevel;
 		setloopvar(".sh.value", "BUFFER");	/* Hack */
 		pm->node.flags |= PM_READONLY;
 	    }
 	} else
-	    sh_name = sh_subscript = NULL;
+	    sh_name = sh_subscript = sh_unsetval;
     } else {
-	sh_edchar = sh_name = sh_subscript = NULL;
+	sh_edchar = sh_name = sh_subscript = sh_unsetval;
 	strcpy(sh_edmode, "");
 	/* TODO:
 	 * - disciplines