summaryrefslogtreecommitdiff
path: root/usr.bin/mg/help.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-05-23 20:19:45 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-05-23 20:19:45 +0000
commit8a89bd425d9f56c4867e33e957f8e9658a4b69d6 (patch)
tree1f9eafc20cd91cac26cf98512d334ea6ef0bf8ac /usr.bin/mg/help.c
parent68f295288cb4bb561e8bca5509d2f1ad67cfdb3b (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/help.c')
-rw-r--r--usr.bin/mg/help.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.bin/mg/help.c b/usr.bin/mg/help.c
index 8358a3884eb..3062a2c01ee 100644
--- a/usr.bin/mg/help.c
+++ b/usr.bin/mg/help.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: help.c,v 1.5 2001/05/23 16:14:00 art Exp $ */
+/* $OpenBSD: help.c,v 1.6 2001/05/23 20:19:44 art Exp $ */
/*
* Help functions for Mg 2
@@ -52,21 +52,19 @@ desckey(f, n)
pep[-1] = ' ';
pep = keyname(pep, key.k_chars[key.k_count++] =
c = getkey(FALSE));
- if ((funct = doscan(curmap, c)) != NULL)
+ if ((funct = doscan(curmap, c, &curmap)) != NULL)
break;
*pep++ = '-';
*pep = '\0';
- curmap = ele->k_prefmap;
}
if (funct != rescan)
break;
if (ISUPPER(key.k_chars[key.k_count - 1])) {
funct = doscan(curmap,
- TOLOWER(key.k_chars[key.k_count - 1]));
+ TOLOWER(key.k_chars[key.k_count - 1]), &curmap);
if (funct == NULL) {
*pep++ = '-';
*pep = '\0';
- curmap = ele->k_prefmap;
continue;
}
if (funct != rescan)
@@ -77,14 +75,13 @@ nextmode:
break;
curmap = curbp->b_modes[m]->p_map;
for (i = 0; i < key.k_count; i++) {
- funct = doscan(curmap, key.k_chars[i]);
+ funct = doscan(curmap, key.k_chars[i], &curmap);
if (funct != NULL) {
if (i == key.k_count - 1 && funct != rescan)
goto found;
funct = rescan;
goto nextmode;
}
- curmap = ele->k_prefmap;
}
*pep++ = '-';
*pep = '\0';
@@ -207,7 +204,7 @@ help_help(f, n)
return FALSE;
ewprintf("a b c: ");
do {
- funct = doscan(kp, getkey(FALSE));
+ funct = doscan(kp, getkey(FALSE), NULL);
} while (funct == NULL || funct == help_help);
#ifndef NO_MACRO
if (macrodef && macrocount < MAXMACRO)