summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/complete.c5
-rw-r--r--Src/builtin.c4
-rw-r--r--Src/zsh.h1
3 files changed, 8 insertions, 2 deletions
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index b28b95ef9..4bf238fab 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -1238,8 +1238,9 @@ makecompparams(void)
 
     addcompparams(comprparams, comprpms);
 
-    if (!(cpm = createparam(COMPSTATENAME,
-			    PM_SPECIAL|PM_REMOVABLE|PM_LOCAL|PM_HASHED)))
+    if (!(cpm = createparam(
+	      COMPSTATENAME,
+	      PM_SPECIAL|PM_REMOVABLE|PM_SINGLE|PM_LOCAL|PM_HASHED)))
 	cpm = (Param) paramtab->getnode(paramtab, COMPSTATENAME);
     DPUTS(!cpm, "param not set in makecompparams");
 
diff --git a/Src/builtin.c b/Src/builtin.c
index da453000c..3b82c9e7f 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2266,6 +2266,10 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 	    zerrnam(cname, "%s: restricted", pname);
 	    return pm;
 	}
+	if (pm->node.flags & PM_SINGLE) {
+	    zerrnam(cname, "%s: can only have a single instance", pname);
+	    return pm;
+	}
 	/*
 	 * For specials, we keep the same struct but zero everything.
 	 * Maybe it would be easier to create a new struct but copy
diff --git a/Src/zsh.h b/Src/zsh.h
index 36fddd000..87e6a9868 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1792,6 +1792,7 @@ struct tieddata {
 #define PM_ZSHSTORED	(1<<18) /* function stored in zsh form              */
 
 /* Remaining flags do not correspond directly to command line arguments */
+#define PM_SINGLE       (1<<20) /* special can only have a single instance  */
 #define PM_LOCAL	(1<<21) /* this parameter will be made local        */
 #define PM_SPECIAL	(1<<22) /* special builtin parameter                */
 #define PM_DONTIMPORT	(1<<23)	/* do not import this variable              */