summaryrefslogtreecommitdiff
path: root/cmd-line-utils/libedit
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-02-27 03:44:44 +0200
committerunknown <monty@narttu.mysql.fi>2003-02-27 03:44:44 +0200
commit669cbe6e5fffb715e117a96273db9c95e229b3a9 (patch)
treee734507eb0df4722e03a80a37b7b9a4c53728c3e /cmd-line-utils/libedit
parenta7e3ba1df50e4be9148baa2396a0d19f4fe73b8e (diff)
downloadmariadb-git-669cbe6e5fffb715e117a96273db9c95e229b3a9.tar.gz
Portability fixes
Don't define crc32 if we are not linking with gzip cmd-line-utils/libedit/libedit_term.h: Rename: cmd-line-utils/libedit/term.h -> cmd-line-utils/libedit/libedit_term.h BitKeeper/etc/ignore: added scripts/make_win_src_distribution client/connect_test.c: Removed wrong include file (my_global.h should never be included by an external client) client/insert_test.c: Removed wrong include file (my_global.h should never be included by an external client) client/select_test.c: Removed wrong include file (my_global.h should never be included by an external client) cmd-line-utils/libedit/Makefile.am: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/el.h: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/key.h: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/makelist: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/read.c: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/readline.c: Portability fixes (for HPUX11 and AIX) cmd-line-utils/libedit/readline/readline.h: Systems that has sys/cdefs may not have __BEGIN_DECLS cmd-line-utils/libedit/sig.c: sig_t is not portable cmd-line-utils/libedit/sig.h: sig_t is not portable cmd-line-utils/libedit/term.c: Portablity fixes Fixed core dump when using a terminal without arrow key definitions heap/_check.c: Portability fix heap/hp_hash.c: Portability fix heap/hp_rkey.c: Portability fix include/my_global.h: Portability fixes for HPUX11 libmysql/libmysql.c: Removed wrong cast mysql-test/r/union.result: New union tests mysql-test/t/union.test: New union tests sql/gen_lex_hash.cc: Fixed portability bug. sql/gstream.h: Portablity fix sql/item_create.cc: Don't define crc32 if we are not linking with gzip sql/item_create.h: Don't define crc32 if we are not linking with gzip sql/item_func.cc: Don't define crc32 if we are not linking with gzip sql/item_func.h: Don't define crc32 if we are not linking with gzip sql/lex.h: Don't define crc32 if we are not linking with gzip sql/sql_show.cc: Name can't be NULL
Diffstat (limited to 'cmd-line-utils/libedit')
-rw-r--r--cmd-line-utils/libedit/Makefile.am2
-rw-r--r--cmd-line-utils/libedit/el.h2
-rw-r--r--cmd-line-utils/libedit/key.h4
-rw-r--r--cmd-line-utils/libedit/libedit_term.h (renamed from cmd-line-utils/libedit/term.h)0
-rw-r--r--cmd-line-utils/libedit/makelist2
-rw-r--r--cmd-line-utils/libedit/read.c4
-rw-r--r--cmd-line-utils/libedit/readline.c11
-rw-r--r--cmd-line-utils/libedit/readline/readline.h3
-rw-r--r--cmd-line-utils/libedit/sig.c6
-rw-r--r--cmd-line-utils/libedit/sig.h4
-rw-r--r--cmd-line-utils/libedit/term.c14
11 files changed, 37 insertions, 15 deletions
diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am
index 631c61ff350..19171f62ffb 100644
--- a/cmd-line-utils/libedit/Makefile.am
+++ b/cmd-line-utils/libedit/Makefile.am
@@ -22,7 +22,7 @@ noinst_HEADERS = chared.h el.h histedit.h key.h \
parse.h refresh.h sig.h sys.h \
tokenizer.h compat.h compat_conf.h fgetln.h \
hist.h map.h prompt.h search.h \
- strlcpy.h term.h tty.h
+ strlcpy.h libedit_term.h tty.h
EXTRA_DIST = makelist
diff --git a/cmd-line-utils/libedit/el.h b/cmd-line-utils/libedit/el.h
index 484cbab6122..7cf17e8f069 100644
--- a/cmd-line-utils/libedit/el.h
+++ b/cmd-line-utils/libedit/el.h
@@ -96,7 +96,7 @@ typedef struct el_state_t {
#include "tty.h"
#include "prompt.h"
#include "key.h"
-#include "term.h"
+#include "libedit_term.h"
#include "refresh.h"
#include "chared.h"
#include "common.h"
diff --git a/cmd-line-utils/libedit/key.h b/cmd-line-utils/libedit/key.h
index c3a0889f901..e95731d9df5 100644
--- a/cmd-line-utils/libedit/key.h
+++ b/cmd-line-utils/libedit/key.h
@@ -62,6 +62,10 @@ typedef struct el_key_t {
#define XK_NOD 2
#define XK_EXE 3
+#undef key_end
+#undef key_clear
+#undef key_print
+
protected int key_init(EditLine *);
protected void key_end(EditLine *);
protected key_value_t *key_map_cmd(EditLine *, int);
diff --git a/cmd-line-utils/libedit/term.h b/cmd-line-utils/libedit/libedit_term.h
index 9f03c549515..9f03c549515 100644
--- a/cmd-line-utils/libedit/term.h
+++ b/cmd-line-utils/libedit/libedit_term.h
diff --git a/cmd-line-utils/libedit/makelist b/cmd-line-utils/libedit/makelist
index 8e9835309d6..3c3338e9875 100644
--- a/cmd-line-utils/libedit/makelist
+++ b/cmd-line-utils/libedit/makelist
@@ -87,6 +87,7 @@ case $FLAG in
cat $FILES | $AWK '
BEGIN {
printf("/* Automatically generated file, do not edit */\n");
+ printf("#include \"compat.h\"\n");
printf("#include \"sys.h\"\n#include \"el.h\"\n");
printf("private const struct el_bindings_t el_func_help[] = {\n");
low = "abcdefghijklmnopqrstuvwxyz_";
@@ -169,6 +170,7 @@ case $FLAG in
cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK '
BEGIN {
printf("/* Automatically generated file, do not edit */\n");
+ printf("#include \"compat.h\"\n");
printf("#include \"sys.h\"\n#include \"el.h\"\n");
printf("private const el_func_t el_func[] = {");
maxlen = 80;
diff --git a/cmd-line-utils/libedit/read.c b/cmd-line-utils/libedit/read.c
index 05f9e3da454..ffec4671271 100644
--- a/cmd-line-utils/libedit/read.c
+++ b/cmd-line-utils/libedit/read.c
@@ -55,6 +55,10 @@ private int read_preread(EditLine *);
private int read_getcmd(EditLine *, el_action_t *, char *);
private int read_char(EditLine *, char *);
+#ifndef MIN
+#define MIN(A,B) ((A) < (B) ? (A) : (B))
+#endif
+
#ifdef DEBUG_EDIT
private void
read_debug(EditLine *el)
diff --git a/cmd-line-utils/libedit/readline.c b/cmd-line-utils/libedit/readline.c
index e9c8409102c..863ee064ab0 100644
--- a/cmd-line-utils/libedit/readline.c
+++ b/cmd-line-utils/libedit/readline.c
@@ -52,6 +52,9 @@
#include "sys.h"
#include "el.h"
#include "fcns.h" /* for EL_NUM_FCNS */
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
/* for rl_complete() */
#define TAB '\r'
@@ -389,7 +392,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
*result = NULL;
- cmd = alloca(cmdlen + 1);
+ cmd = (char*) alloca(cmdlen + 1);
(void) strncpy(cmd, command, cmdlen);
cmd[cmdlen] = 0;
@@ -422,7 +425,7 @@ _history_expand_command(const char *command, size_t cmdlen, char **result)
return (-1);
prefix = 0;
}
- search = alloca(len + 1);
+ search = (char*) alloca(len + 1);
(void) strncpy(search, &cmd[idx], len);
search[len] = '\0';
@@ -662,7 +665,7 @@ history_expand(char *str, char **output)
if (str[0] == history_subst_char) {
/* ^foo^foo2^ is equivalent to !!:s^foo^foo2^ */
- temp = alloca(4 + strlen(str) + 1);
+ temp = (char*) alloca(4 + strlen(str) + 1);
temp[0] = temp[1] = history_expansion_char;
temp[2] = ':';
temp[3] = 's';
@@ -1456,7 +1459,7 @@ rl_complete_internal(int what_to_do)
ctemp--;
len = li->cursor - ctemp;
- temp = alloca(len + 1);
+ temp = (char*) alloca(len + 1);
(void) strncpy(temp, ctemp, len);
temp[len] = '\0';
diff --git a/cmd-line-utils/libedit/readline/readline.h b/cmd-line-utils/libedit/readline/readline.h
index 851ade02b53..930c32d6f1c 100644
--- a/cmd-line-utils/libedit/readline/readline.h
+++ b/cmd-line-utils/libedit/readline/readline.h
@@ -41,7 +41,7 @@
#include <sys/types.h>
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
-#else
+#endif
#ifndef __BEGIN_DECLS
#if defined(__cplusplus)
#define __BEGIN_DECLS extern "C" {
@@ -51,7 +51,6 @@
#define __END_DECLS
#endif
#endif
-#endif
/* list of readline stuff supported by editline library's readline wrapper */
diff --git a/cmd-line-utils/libedit/sig.c b/cmd-line-utils/libedit/sig.c
index 19408a0a8f2..bfb3d5c93f9 100644
--- a/cmd-line-utils/libedit/sig.c
+++ b/cmd-line-utils/libedit/sig.c
@@ -115,9 +115,9 @@ sig_init(EditLine *el)
#undef _DO
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
-#define SIGSIZE (sizeof(sighdl) / sizeof(sighdl[0]) * sizeof(sig_t))
+#define SIGSIZE (sizeof(sighdl) / sizeof(sighdl[0]) * sizeof(libedit_sig_t))
- el->el_signal = (sig_t *) el_malloc(SIGSIZE);
+ el->el_signal = (el_signal_t) el_malloc(SIGSIZE);
if (el->el_signal == NULL)
return (-1);
for (i = 0; sighdl[i] != -1; i++)
@@ -157,7 +157,7 @@ sig_set(EditLine *el)
(void) sigprocmask(SIG_BLOCK, &nset, &oset);
for (i = 0; sighdl[i] != -1; i++) {
- sig_t s;
+ libedit_sig_t s;
/* This could happen if we get interrupted */
if ((s = signal(sighdl[i], sig_handler)) != sig_handler)
el->el_signal[i] = s;
diff --git a/cmd-line-utils/libedit/sig.h b/cmd-line-utils/libedit/sig.h
index e7231b65cf4..399e3a69437 100644
--- a/cmd-line-utils/libedit/sig.h
+++ b/cmd-line-utils/libedit/sig.h
@@ -62,7 +62,9 @@
_DO(SIGCONT) \
_DO(SIGWINCH)
-typedef sig_t *el_signal_t;
+typedef RETSIGTYPE (*libedit_sig_t)();
+typedef libedit_sig_t *el_signal_t;
+
protected void sig_end(EditLine*);
protected int sig_init(EditLine*);
diff --git a/cmd-line-utils/libedit/term.c b/cmd-line-utils/libedit/term.c
index df8d1ea67cc..bcda9ac1216 100644
--- a/cmd-line-utils/libedit/term.c
+++ b/cmd-line-utils/libedit/term.c
@@ -43,13 +43,19 @@
* We have to declare a static variable here, since the
* termcap putchar routine does not take an argument!
*/
+
#include "sys.h"
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#if defined(HAVE_TERMCAP_H)
#include <termcap.h>
+#elif defined(HAVE_CURSES_H) && defined(HAVE_TERM_H) /* For HPUX11 */
+#include <curses.h>
+#include <term.h>
+#endif
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -891,7 +897,7 @@ term_set(EditLine *el, const char *term)
memset(el->el_term.t_cap, 0, TC_BUFSIZE);
- i = tgetent(el->el_term.t_cap, term);
+ i = tgetent(el->el_term.t_cap, (char*) term);
if (i <= 0) {
if (i == -1)
@@ -921,7 +927,7 @@ term_set(EditLine *el, const char *term)
Val(T_co) = tgetnum("co");
Val(T_li) = tgetnum("li");
for (t = tstr; t->name != NULL; t++)
- term_alloc(el, t, tgetstr(t->name, &area));
+ term_alloc(el, t, tgetstr((char*) t->name, &area));
}
if (Val(T_co) < 2)
@@ -1061,6 +1067,8 @@ term_reset_arrow(EditLine *el)
static const char stOH[] = {033, 'O', 'H', '\0'};
static const char stOF[] = {033, 'O', 'F', '\0'};
+ term_init_arrow(el); /* Init arrow struct */
+
key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
@@ -1421,7 +1429,7 @@ term_echotc(EditLine *el, int argc __attribute__((unused)), const char **argv)
break;
}
if (t->name == NULL)
- scap = tgetstr(*argv, &area);
+ scap = tgetstr((char*) *argv, &area);
if (!scap || scap[0] == '\0') {
if (!silent)
(void) fprintf(el->el_errfile,