summary refs log tree commit diff
path: root/Src/init.c
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2013-04-30 00:22:03 -0700
committerBart Schaefer <schaefer@zsh.org>2013-04-30 00:22:03 -0700
commit4e43360261e88346bd71b238f423cbf5bc8e1eff (patch)
treea3aeed15b6187d854fd09282a733c23a43398b82 /Src/init.c
parentf4b083327064c122945901736c19f381d3f67499 (diff)
downloadzsh-4e43360261e88346bd71b238f423cbf5bc8e1eff.tar.gz
zsh-4e43360261e88346bd71b238f423cbf5bc8e1eff.tar.xz
zsh-4e43360261e88346bd71b238f423cbf5bc8e1eff.zip
31361: handle negative optno ("no" prefix used)
when storing options with parseopts_insert() for sticky contexts
Diffstat (limited to 'Src/init.c')
-rw-r--r--Src/init.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Src/init.c b/Src/init.c
index f4fb3bee4..01a969df4 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -281,9 +281,10 @@ parseargs(char **argv, char **runscript)
 
 /**/
 static void
-parseopts_insert(LinkList optlist, void *ptr)
+parseopts_insert(LinkList optlist, void *base, int optno)
 {
     LinkNode node;
+    void *ptr = base + (optno < 0 ? -optno : optno);
 
     for (node = firstnode(optlist); node; incnode(node)) {
 	if (ptr < getdata(node)) {
@@ -390,7 +391,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
 		    if (dosetopt(optno, action, !nam, new_opts) && nam) {
 			WARN_OPTION("can't change option: %s", *argv);
 		    } else if (optlist) {
-			parseopts_insert(optlist, new_opts+optno);
+			parseopts_insert(optlist, new_opts, optno);
 		    }
 		}
               break;
@@ -415,7 +416,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
 		    if (dosetopt(optno, action, !nam, new_opts) && nam) {
 			WARN_OPTION("can't change option: -%c", **argv);
 		    } else if (optlist) {
-			parseopts_insert(optlist, new_opts+optno);
+			parseopts_insert(optlist, new_opts, optno);
 		    }
 		}
 	    }