diff options
Diffstat (limited to 'lib/libedit/keymacro.c')
-rw-r--r-- | lib/libedit/keymacro.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/libedit/keymacro.c b/lib/libedit/keymacro.c index e10ed7f63cb2..1a1bdd5947e6 100644 --- a/lib/libedit/keymacro.c +++ b/lib/libedit/keymacro.c @@ -1,4 +1,4 @@ -/* $NetBSD: keymacro.c,v 1.14 2016/02/24 14:25:38 christos Exp $ */ +/* $NetBSD: keymacro.c,v 1.7 2011/08/16 16:25:15 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: keymacro.c,v 1.14 2016/02/24 14:25:38 christos Exp $"); +__RCSID("$NetBSD: keymacro.c,v 1.7 2011/08/16 16:25:15 christos Exp $"); #endif #endif /* not lint && not SCCSID */ #include <sys/cdefs.h> @@ -65,8 +65,8 @@ __FBSDID("$FreeBSD$"); * 1) It is not possible to have one key that is a * substr of another. */ -#include <stdlib.h> #include <string.h> +#include <stdlib.h> #include "el.h" @@ -75,10 +75,10 @@ __FBSDID("$FreeBSD$"); * linked list of these node elements */ struct keymacro_node_t { - Char ch; /* single character of key */ + Char ch; /* single character of key */ int type; /* node type */ keymacro_value_t val; /* command code or pointer to str, */ - /* if this is a leaf */ + /* if this is a leaf */ struct keymacro_node_t *next; /* ptr to next char of this key */ struct keymacro_node_t *sibling;/* ptr to another key with same prefix*/ }; @@ -87,7 +87,7 @@ private int node_trav(EditLine *, keymacro_node_t *, Char *, keymacro_value_t *); private int node__try(EditLine *, keymacro_node_t *, const Char *, keymacro_value_t *, int); -private keymacro_node_t *node__get(wint_t); +private keymacro_node_t *node__get(Int); private void node__free(keymacro_node_t *); private void node__put(EditLine *, keymacro_node_t *); private int node__delete(EditLine *, keymacro_node_t **, @@ -277,23 +277,21 @@ keymacro_print(EditLine *el, const Char *key) /* node_trav(): * recursively traverses node in tree until match or mismatch is - * found. May read in more characters. + * found. May read in more characters. */ private int node_trav(EditLine *el, keymacro_node_t *ptr, Char *ch, keymacro_value_t *val) { - wchar_t wc; if (ptr->ch == *ch) { /* match found */ if (ptr->next) { /* key not complete so get next char */ - if (el_wgetc(el, &wc) != 1) {/* if EOF or error */ + if (FUN(el,getc)(el, ch) != 1) {/* if EOF or error */ val->cmd = ED_END_OF_FILE; return XK_CMD; /* PWP: Pretend we just read an end-of-file */ } - *ch = (Char)wc; return node_trav(el, ptr->next, ch, val); } else { *val = ptr->val; @@ -316,7 +314,7 @@ node_trav(EditLine *el, keymacro_node_t *ptr, Char *ch, keymacro_value_t *val) /* node__try(): - * Find a node that matches *str or allocate a new one + * Find a node that matches *str or allocate a new one */ private int node__try(EditLine *el, keymacro_node_t *ptr, const Char *str, @@ -462,14 +460,14 @@ node__put(EditLine *el, keymacro_node_t *ptr) * Returns pointer to a keymacro_node_t for ch. */ private keymacro_node_t * -node__get(wint_t ch) +node__get(Int ch) { keymacro_node_t *ptr; ptr = el_malloc(sizeof(*ptr)); if (ptr == NULL) return NULL; - ptr->ch = (Char)ch; + ptr->ch = ch; ptr->type = XK_NOD; ptr->val.str = NULL; ptr->next = NULL; @@ -598,7 +596,7 @@ keymacro_kprint(EditLine *el, const Char *key, keymacro_value_t *val, int ntype) case XK_STR: case XK_EXE: (void) keymacro__decode_str(val->str, unparsbuf, - sizeof(unparsbuf), + sizeof(unparsbuf), ntype == XK_STR ? "\"\"" : "[]"); (void) fprintf(el->el_outfile, fmt, ct_encode_string(key, &el->el_scratch), unparsbuf); |