summaryrefslogtreecommitdiff
path: root/cmd-line-utils/libedit/key.c
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-09-06 15:14:10 +0300
committerunknown <monty@mysql.com>2004-09-06 15:14:10 +0300
commit4ad51359c1b7b5ed854f1af8df06fd6912068d28 (patch)
treed9ef905036723648a1d354d0523ef8124e4dee76 /cmd-line-utils/libedit/key.c
parentfa3bfbe45796edd85cce30e62ff1fcfb81df745c (diff)
parent9a63c8e0e468d7a64dcb7e23f4e5c344eebf635b (diff)
downloadmariadb-git-4ad51359c1b7b5ed854f1af8df06fd6912068d28.tar.gz
Merge with 4.1
(Includes merge of arena code in 4.1 and 5.0) BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union VC++Files/sql/mysqld.dsp: Auto merged client/mysql.cc: Auto merged client/mysqltest.c: Auto merged include/my_global.h: Auto merged include/my_sys.h: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged innobase/row/row0sel.c: Auto merged libmysql/client_settings.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/Makefile.am: Auto merged libmysqld/examples/Makefile.am: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged myisam/sort.c: Auto merged mysql-test/r/connect.result: Auto merged mysql-test/r/ctype_recoding.result: Auto merged mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/func_in.result: Auto merged mysql-test/r/func_like.result: Auto merged mysql-test/r/gis.result: Auto merged mysql-test/r/having.result: Auto merged mysql-test/r/heap.result: Auto merged mysql-test/r/join.result: Auto merged mysql-test/r/key.result: Auto merged mysql-test/r/lowercase_table.result: Auto merged mysql-test/r/ndb_autodiscover.result: Auto merged mysql-test/r/null.result: Auto merged mysql-test/r/olap.result: Auto merged mysql-test/r/order_by.result: Auto merged mysql-test/r/ps_1general.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/range.result: Auto merged mysql-test/r/rename.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/alter_table.test: Auto merged mysql-test/t/null.test: Auto merged mysql-test/t/ps_1general.test: Auto merged mysql-test/t/rpl_charset.test: Auto merged mysql-test/t/rpl_heap.test: Auto merged mysql-test/t/rpl_relayrotate.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/variables.test: Auto merged netware/mysql_test_run.c: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysql_create_system_tables.sh: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged scripts/mysql_install_db.sh: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_create.cc: Auto merged sql/item_create.h: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_timefunc.cc: Auto merged sql/item_timefunc.h: Auto merged sql/lex.h: Auto merged sql/lock.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_sum.cc: Auto merged sql/protocol.cc: Auto merged sql/records.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_string.h: Auto merged sql/table.cc: Auto merged sql-common/client.c: Auto merged client/mysqlbinlog.cc: Merge with 4.1 configure.in: Merge with 4.1 include/mysqld_error.h: Add new error message (1) from 4.1 mysql-test/mysql-test-run.sh: Merge with 4.1 mysql-test/r/func_gconcat.result: Merge with 4.1 mysql-test/r/func_if.result: Merge with 4.1 mysql-test/r/grant.result: Merge with 4.1 mysql-test/r/join_outer.result: Merge with 4.1 mysql-test/r/rpl_charset.result: Merge with 4.1 (This has to be fixed before pushing) mysql-test/r/system_mysql_db.result: Merge with 4.1. Added collation to new privileges mysql-test/t/grant.test: Merge with 4.1 mysql-test/t/grant_cache.test: Merge with 4.1 mysql-test/t/show_check.test: Merge with 4.1 sql/Makefile.am: Merge with 4.1 sql/item.cc: Merge with 4.1 sql/item_cmpfunc.cc: Merge with 4.1 (arena code) sql/item_subselect.cc: Merge with 4.1 sql/item_subselect.h: Merge with 4.1 sql/item_sum.cc: Merge with 4.1 sql/item_sum.h: Merge with 4.1 sql/log.cc: Merge with 4.1 (Remove code that is not relevant for 5.0) sql/mysqld.cc: Merge with 4.1 sql/opt_range.cc: Merge with 4.1 sql/share/czech/errmsg.txt: Merge with 4.1 sql/share/danish/errmsg.txt: Merge with 4.1 sql/share/dutch/errmsg.txt: Merge with 4.1 sql/share/english/errmsg.txt: Merge with 4.1 sql/share/estonian/errmsg.txt: Merge with 4.1 sql/share/french/errmsg.txt: Merge with 4.1 sql/share/german/errmsg.txt: Merge with 4.1 sql/share/greek/errmsg.txt: Merge with 4.1 sql/share/hungarian/errmsg.txt: Merge with 4.1 sql/share/italian/errmsg.txt: Merge with 4.1 sql/share/japanese/errmsg.txt: Merge with 4.1 sql/share/korean/errmsg.txt: Merge with 4.1 sql/share/norwegian-ny/errmsg.txt: Merge with 4.1 sql/share/norwegian/errmsg.txt: Merge with 4.1 sql/share/polish/errmsg.txt: Merge with 4.1 sql/share/portuguese/errmsg.txt: Merge with 4.1 sql/share/romanian/errmsg.txt: Merge with 4.1 sql/share/russian/errmsg.txt: Merge with 4.1 sql/share/serbian/errmsg.txt: Merge with 4.1 sql/share/slovak/errmsg.txt: Merge with 4.1 sql/share/spanish/errmsg.txt: Merge with 4.1 sql/share/swedish/errmsg.txt: Merge with 4.1 sql/share/ukrainian/errmsg.txt: Merge with 4.1 sql/sql_base.cc: Merge with 4.1 sql/sql_class.cc: Merge with 4.1 Use arena code from 4.1 sql/sql_class.h: Merge with 4.1 Use arena code from 4.1 sql/sql_derived.cc: Merge with 4.1 sql/sql_lex.cc: Merge with 4.1 sql/sql_lex.h: Merge with 4.1 sql/sql_parse.cc: Merge with 4.1 sql/sql_prepare.cc: Merge with 4.1 sql/sql_select.cc: Merge with 4.1 sql/sql_table.cc: Merge with 4.1 sql/sql_union.cc: Merge with 4.1 sql/sql_yacc.yy: Merge with 4.1 sql/tztime.cc: Merge with 4.1 tests/client_test.c: Merge with 4.1
Diffstat (limited to 'cmd-line-utils/libedit/key.c')
-rw-r--r--cmd-line-utils/libedit/key.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/cmd-line-utils/libedit/key.c b/cmd-line-utils/libedit/key.c
index 629c6aeeb9c..e75db00ce1b 100644
--- a/cmd-line-utils/libedit/key.c
+++ b/cmd-line-utils/libedit/key.c
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.12 2001/05/17 01:02:17 christos Exp $ */
+/* $NetBSD: key.c,v 1.13 2002/03/18 16:00:55 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,7 +36,14 @@
* SUCH DAMAGE.
*/
-#include "compat.h"
+#include "config.h"
+#if !defined(lint) && !defined(SCCSID)
+#if 0
+static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: key.c,v 1.13 2002/03/18 16:00:55 christos Exp $");
+#endif
+#endif /* not lint && not SCCSID */
/*
* key.c: This module contains the procedures for maintaining
@@ -59,7 +66,6 @@
* 1) It is not possible to have one key that is a
* substr of another.
*/
-#include "sys.h"
#include <string.h>
#include <stdlib.h>
@@ -85,8 +91,8 @@ private int node__try(EditLine *, key_node_t *, const char *,
private key_node_t *node__get(int);
private void node__put(EditLine *, key_node_t *);
private int node__delete(EditLine *, key_node_t **, const char *);
-private int node_lookup(EditLine *, const char *,
- key_node_t *, int);
+private int node_lookup(EditLine *, const char *, key_node_t *,
+ int);
private int node_enum(EditLine *, key_node_t *, int);
private int key__decode_char(char *, int, int);
@@ -97,14 +103,14 @@ private int key__decode_char(char *, int, int);
* Initialize the key maps
*/
protected int
-key_init(EditLine *el)
+el_key_init(EditLine *el)
{
el->el_key.buf = (char *) el_malloc(KEY_BUFSIZ);
if (el->el_key.buf == NULL)
return (-1);
el->el_key.map = NULL;
- key_reset(el);
+ el_key_reset(el);
return (0);
}
@@ -113,7 +119,7 @@ key_init(EditLine *el)
* Free the key maps
*/
protected void
-key_end(EditLine *el)
+el_key_end(EditLine *el)
{
el_free((ptr_t) el->el_key.buf);
@@ -127,7 +133,7 @@ key_end(EditLine *el)
* Associate cmd with a key value
*/
protected key_value_t *
-key_map_cmd(EditLine *el, int cmd)
+el_key_map_cmd(EditLine *el, int cmd)
{
el->el_key.val.cmd = (el_action_t) cmd;
@@ -139,7 +145,7 @@ key_map_cmd(EditLine *el, int cmd)
* Associate str with a key value
*/
protected key_value_t *
-key_map_str(EditLine *el, char *str)
+el_key_map_str(EditLine *el, char *str)
{
el->el_key.val.str = str;
@@ -153,7 +159,7 @@ key_map_str(EditLine *el, char *str)
* [Always bind the ansi arrow keys?]
*/
protected void
-key_reset(EditLine *el)
+el_key_reset(EditLine *el)
{
node__put(el, el->el_key.map);
@@ -171,7 +177,7 @@ key_reset(EditLine *el)
* The last character read is returned in *ch.
*/
protected int
-key_get(EditLine *el, char *ch, key_value_t *val)
+el_key_get(EditLine *el, char *ch, key_value_t *val)
{
return (node_trav(el, el->el_key.map, ch, val));
@@ -185,7 +191,7 @@ key_get(EditLine *el, char *ch, key_value_t *val)
* out str or a unix command.
*/
protected void
-key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
+el_key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
{
if (key[0] == '\0') {
@@ -213,7 +219,7 @@ key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
*
*/
protected void
-key_clear(EditLine *el, el_action_t *map, const char *in)
+el_key_clear(EditLine *el, el_action_t *map, const char *in)
{
if ((map[(unsigned char)*in] == ED_SEQUENCE_LEAD_IN) &&
@@ -221,7 +227,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in)
el->el_map.alt[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN) ||
(map == el->el_map.alt &&
el->el_map.key[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN)))
- (void) key_delete(el, in);
+ (void) el_key_delete(el, in);
}
@@ -230,7 +236,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in)
* they exists.
*/
protected int
-key_delete(EditLine *el, const char *key)
+el_key_delete(EditLine *el, const char *key)
{
if (key[0] == '\0') {
@@ -251,7 +257,7 @@ key_delete(EditLine *el, const char *key)
* Print entire el->el_key.map if null
*/
protected void
-key_print(EditLine *el, const char *key)
+el_key_print(EditLine *el, const char *key)
{
/* do nothing if el->el_key.map is empty and null key specified */
@@ -498,7 +504,7 @@ node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt)
if (str[1] == 0) {
el->el_key.buf[ncnt + 1] = '"';
el->el_key.buf[ncnt + 2] = '\0';
- key_kprint(el, el->el_key.buf,
+ el_key_kprint(el, el->el_key.buf,
&ptr->val, ptr->type);
return (0);
} else
@@ -546,7 +552,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
/* print this key and function */
el->el_key.buf[ncnt + 1] = '"';
el->el_key.buf[ncnt + 2] = '\0';
- key_kprint(el, el->el_key.buf, &ptr->val, ptr->type);
+ el_key_kprint(el, el->el_key.buf, &ptr->val, ptr->type);
} else
(void) node_enum(el, ptr->next, ncnt + 1);
@@ -562,7 +568,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
* function specified by val
*/
protected void
-key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
+el_key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
{
el_bindings_t *fp;
char unparsbuf[EL_BUFSIZ];
@@ -573,7 +579,7 @@ key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
case XK_STR:
case XK_EXE:
(void) fprintf(el->el_outfile, fmt, key,
- key__decode_str(val->str, unparsbuf,
+ el_key__decode_str(val->str, unparsbuf,
ntype == XK_STR ? "\"\"" : "[]"));
break;
case XK_CMD:
@@ -638,9 +644,9 @@ key__decode_char(char *buf, int cnt, int ch)
* Make a printable version of the ey
*/
protected char *
-key__decode_str(const char *str, char *buf, const char *sep)
+el_key__decode_str(const char *str, char *buf, const char *sep)
{
- char *b;
+ char *b;
const char *p;
b = buf;