diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-05-23 20:19:45 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-05-23 20:19:45 +0000 |
commit | 8a89bd425d9f56c4867e33e957f8e9658a4b69d6 (patch) | |
tree | 1f9eafc20cd91cac26cf98512d334ea6ef0bf8ac /usr.bin/mg/extend.c | |
parent | 68f295288cb4bb561e8bca5509d2f1ad67cfdb3b (diff) |
Add an argument to doscan which is a pointer to a KEYMAP pointer.
If that argument is not NULL, we set it to the k_prefmap of the pressed
key if there is one.
This is what most of the users of doscan did anyway, but they did it through
leaked global state.
Diffstat (limited to 'usr.bin/mg/extend.c')
-rw-r--r-- | usr.bin/mg/extend.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c index 5f5ed3d14e4..17c9bc90d20 100644 --- a/usr.bin/mg/extend.c +++ b/usr.bin/mg/extend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: extend.c,v 1.7 2001/05/23 16:13:59 art Exp $ */ +/* $OpenBSD: extend.c,v 1.8 2001/05/23 20:19:44 art Exp $ */ /* * Extended (M-X) commands, rebinding, and startup file processing. @@ -339,15 +339,14 @@ dobind(curmap, p, unbind) #ifndef NO_STARTUP if (inmacro) { for (s = 0; s < maclcur->l_used - 1; s++) { - if (doscan(curmap, c = CHARMASK(maclcur->l_text[s])) + if (doscan(curmap, c = CHARMASK(maclcur->l_text[s]), &curmap) != NULL) { if (remap(curmap, c, NULL, (KEYMAP *)NULL) != TRUE) return FALSE; } - curmap = ele->k_prefmap; } - (VOID)doscan(curmap, c = maclcur->l_text[s]); + (VOID)doscan(curmap, c = maclcur->l_text[s], NULL); maclcur = maclcur->l_fp; } else { #endif /* !NO_STARTUP */ @@ -358,11 +357,10 @@ dobind(curmap, p, unbind) ewprintf("%s", prompt); pep[-1] = ' '; pep = keyname(pep, c = getkey(FALSE)); - if (doscan(curmap, c) != NULL) + if (doscan(curmap, c, &curmap) != NULL) break; *pep++ = '-'; *pep = '\0'; - curmap = ele->k_prefmap; } #ifndef NO_STARTUP } @@ -409,13 +407,12 @@ bindkey(mapp, fname, keys, kcount) return FALSE; } while (--kcount) { - if (doscan(curmap, c = *keys++) != NULL) { + if (doscan(curmap, c = *keys++, &curmap) != NULL) { if (remap(curmap, c, NULL, (KEYMAP *)NULL) != TRUE) return FALSE; } - curmap = ele->k_prefmap; } - (VOID)doscan(curmap, c = *keys); + (VOID)doscan(curmap, c = *keys, NULL); return remap(curmap, c, funct, pref_map); } |