Merge makelist rev 1.10 and map.c rev 1.22 from NetBSD. They just patch the

bug fixed in the last commit to map.c in a different way.  Follow NetBSD to
facilitate future merges.
This commit is contained in:
Stefan Farfeleder 2005-10-04 21:59:29 +00:00
parent 51890f2fed
commit 6dea540edc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150947
2 changed files with 14 additions and 14 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh -
# $NetBSD: makelist,v 1.9 2005/05/16 13:14:43 lukem Exp $
# $NetBSD: makelist,v 1.10 2005/08/08 14:04:49 christos Exp $
# $FreeBSD$
#
# Copyright (c) 1992, 1993
@ -119,7 +119,6 @@ case $FLAG in
}
}
END {
printf(" { NULL, 0, NULL }\n");
printf("};\n");
printf("\nprotected const el_bindings_t* help__get()");
printf("{ return el_func_help; }\n");

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $NetBSD: map.c,v 1.20 2004/08/13 12:10:39 mycroft Exp $
* $NetBSD: map.c,v 1.22 2005/08/09 13:58:44 christos Exp $
*/
#if !defined(lint) && !defined(SCCSID)
@ -913,11 +913,11 @@ map_init(EditLine *el)
el->el_map.vic = el_map_vi_command;
el->el_map.vii = el_map_vi_insert;
el->el_map.help = (el_bindings_t *) el_malloc(sizeof(el_bindings_t) *
(EL_NUM_FCNS + 1));
EL_NUM_FCNS);
if (el->el_map.help == NULL)
return (-1);
(void) memcpy(el->el_map.help, help__get(),
sizeof(el_bindings_t) * (EL_NUM_FCNS + 1));
sizeof(el_bindings_t) * EL_NUM_FCNS);
el->el_map.func = (el_func_t *)el_malloc(sizeof(el_func_t) *
EL_NUM_FCNS);
if (el->el_map.func == NULL)
@ -1123,11 +1123,12 @@ private void
map_print_key(EditLine *el, el_action_t *map, const char *in)
{
char outbuf[EL_BUFSIZ];
el_bindings_t *bp;
el_bindings_t *bp, *ep;
if (in[0] == '\0' || in[1] == '\0') {
(void) key__decode_str(in, outbuf, "");
for (bp = el->el_map.help; bp->name != NULL; bp++)
ep = &el->el_map.help[el->el_map.nfunc];
for (bp = el->el_map.help; bp < ep; bp++)
if (bp->func == map[(unsigned char) *in]) {
(void) fprintf(el->el_outfile,
"%s\t->\t%s\n", outbuf, bp->name);
@ -1144,7 +1145,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in)
private void
map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
{
el_bindings_t *bp;
el_bindings_t *bp, *ep;
char firstbuf[2], lastbuf[2];
char unparsbuf[EL_BUFSIZ], extrabuf[EL_BUFSIZ];
@ -1159,7 +1160,8 @@ map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
key__decode_str(firstbuf, unparsbuf, STRQQ));
return;
}
for (bp = el->el_map.help; bp->name != NULL; bp++) {
ep = &el->el_map.help[el->el_map.nfunc];
for (bp = el->el_map.help; bp < ep; bp++) {
if (bp->func == map[first]) {
if (first == last) {
(void) fprintf(el->el_outfile, "%-15s-> %s\n",
@ -1242,7 +1244,7 @@ map_bind(EditLine *el, int argc, const char **argv)
char outbuf[EL_BUFSIZ];
const char *in = NULL;
char *out = NULL;
el_bindings_t *bp;
el_bindings_t *bp, *ep;
int cmd;
int key;
@ -1284,8 +1286,8 @@ map_bind(EditLine *el, int argc, const char **argv)
return (0);
case 'l':
for (bp = el->el_map.help; bp->name != NULL;
bp++)
ep = &el->el_map.help[el->el_map.nfunc];
for (bp = el->el_map.help; bp < ep; bp++)
(void) fprintf(el->el_outfile,
"%s\n\t%s\n",
bp->name, bp->description);
@ -1386,7 +1388,7 @@ protected int
map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func)
{
void *p;
int nf = el->el_map.nfunc + 2;
int nf = el->el_map.nfunc + 1;
if (name == NULL || help == NULL || func == NULL)
return (-1);
@ -1405,7 +1407,6 @@ map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func)
el->el_map.help[nf].name = name;
el->el_map.help[nf].func = nf;
el->el_map.help[nf].description = help;
el->el_map.help[++nf].name = NULL;
el->el_map.nfunc++;
return (0);