summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorpeter@mysql.com <>2002-11-29 22:03:14 +0300
committerpeter@mysql.com <>2002-11-29 22:03:14 +0300
commit08f51eaedd8fb15eb629614af323d3cdc64dace1 (patch)
tree09b5a48a4fb2649410bee507206bcfc49ee4c806 /client
parent7e6977808f2d11d1e24997d110268c9f5bb818e5 (diff)
parent87fbeb4098fed0f2e100e00bdd88667d1f738190 (diff)
downloadmariadb-git-08f51eaedd8fb15eb629614af323d3cdc64dace1.tar.gz
Merging....
Diffstat (limited to 'client')
-rw-r--r--client/Makefile.am5
-rw-r--r--client/completion_hash.cc6
-rw-r--r--client/completion_hash.h4
-rw-r--r--client/mysql.cc28
4 files changed, 25 insertions, 18 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index 9c994814714..92c46519275 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -16,9 +16,8 @@
# This file is public domain and comes with NO WARRANTY of any kind
-INCLUDES = -I$(srcdir)/../include \
- -I../include -I$(srcdir)/.. -I$(top_srcdir) \
- -I.. $(openssl_includes)
+#AUTOMAKE_OPTIONS = nostdinc
+INCLUDES = -I$(top_srcdir)/include $(openssl_includes)
LIBS = @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysql/libmysqlclient.la
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
diff --git a/client/completion_hash.cc b/client/completion_hash.cc
index ff5d0b28e41..536e7f9373a 100644
--- a/client/completion_hash.cc
+++ b/client/completion_hash.cc
@@ -27,7 +27,7 @@
#include <my_sys.h>
#include "completion_hash.h"
-uint hashpjw(char *arKey, uint nKeyLength)
+uint hashpjw(const char *arKey, uint nKeyLength)
{
uint h = 0, g, i;
@@ -111,7 +111,7 @@ int completion_hash_update(HashTable *ht, char *arKey, uint nKeyLength,
return SUCCESS;
}
-static Bucket *completion_hash_find(HashTable *ht, char *arKey,
+static Bucket *completion_hash_find(HashTable *ht, const char *arKey,
uint nKeyLength)
{
uint h, nIndex;
@@ -156,7 +156,7 @@ int completion_hash_exists(HashTable *ht, char *arKey, uint nKeyLength)
return 0;
}
-Bucket *find_all_matches(HashTable *ht, char *str, uint length,
+Bucket *find_all_matches(HashTable *ht, const char *str, uint length,
uint *res_length)
{
Bucket *b;
diff --git a/client/completion_hash.h b/client/completion_hash.h
index c0853fddfe7..2595a445c9d 100644
--- a/client/completion_hash.h
+++ b/client/completion_hash.h
@@ -43,14 +43,14 @@ typedef struct hashtable {
uint nTableSize;
uint initialized;
MEM_ROOT mem_root;
- uint(*pHashFunction) (char *arKey, uint nKeyLength);
+ uint(*pHashFunction) (const char *arKey, uint nKeyLength);
Bucket **arBuckets;
} HashTable;
extern int completion_hash_init(HashTable *ht, uint nSize);
extern int completion_hash_update(HashTable *ht, char *arKey, uint nKeyLength, char *str);
extern int hash_exists(HashTable *ht, char *arKey);
-extern Bucket *find_all_matches(HashTable *ht, char *str, uint length, uint *res_length);
+extern Bucket *find_all_matches(HashTable *ht, const char *str, uint length, uint *res_length);
extern Bucket *find_longest_match(HashTable *ht, char *str, uint length, uint *res_length);
extern void add_word(HashTable *ht,char *str);
extern void completion_hash_clean(HashTable *ht);
diff --git a/client/mysql.cc b/client/mysql.cc
index 241f4cf7ecc..13943691fb4 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1049,8 +1049,8 @@ static bool add_line(String &buffer,char *line,char *in_string)
#ifdef HAVE_READLINE
-static char *new_command_generator(char *text, int);
-static char **new_mysql_completion (char *text, int start, int end);
+static char *new_command_generator(const char *text, int);
+static char **new_mysql_completion (const char *text, int start, int end);
/*
Tell the GNU Readline library how to complete. We want to try to complete
@@ -1058,8 +1058,8 @@ static char **new_mysql_completion (char *text, int start, int end);
if not.
*/
-char **no_completion (char *text __attribute__ ((unused)),
- char *word __attribute__ ((unused)))
+char *no_completion (const char *text __attribute__ ((unused)),
+ int )
{
return 0; /* No filename completion */
}
@@ -1070,9 +1070,13 @@ static void initialize_readline (char *name)
rl_readline_name = name;
/* Tell the completer that we want a crack first. */
- /* rl_attempted_completion_function = (CPPFunction *)mysql_completion;*/
- rl_attempted_completion_function = (CPPFunction *) new_mysql_completion;
- rl_completion_entry_function=(Function *) no_completion;
+#if RL_READLINE_VERSION > 0x0400
+ rl_attempted_completion_function = &new_mysql_completion;
+ rl_completion_entry_function= &no_completion;
+#else
+ rl_attempted_completion_function =(CPPFunction *)new_mysql_completion;
+ rl_completion_entry_function= (Function *)no_completion;
+#endif
}
/*
@@ -1082,17 +1086,21 @@ static void initialize_readline (char *name)
array of matches, or NULL if there aren't any.
*/
-static char **new_mysql_completion (char *text,
+static char **new_mysql_completion (const char *text,
int start __attribute__((unused)),
int end __attribute__((unused)))
{
if (!status.batch && !quick)
- return completion_matches(text, (CPFunction*) new_command_generator);
+#if RL_READLINE_VERSION > 0x0400
+ return rl_completion_matches(text, new_command_generator);
+#else
+ return completion_matches((char *)text, (CPFunction *)new_command_generator);
+#endif
else
return (char**) 0;
}
-static char *new_command_generator(char *text,int state)
+static char *new_command_generator(const char *text,int state)
{
static int textlen;
char *ptr;