summaryrefslogtreecommitdiff
path: root/cmd-line-utils/readline/input.c
diff options
context:
space:
mode:
authorunknown <df@pippilotta.erinye.com>2007-11-19 14:38:08 +0100
committerunknown <df@pippilotta.erinye.com>2007-11-19 14:38:08 +0100
commit17146fc93d49fc4354f791f9c269fc21d5000eb6 (patch)
tree6886afa4046d456ba17671394e79a76cec21267a /cmd-line-utils/readline/input.c
parent7bb73945459e71bdd8fa1297dc3fd313306235cc (diff)
downloadmariadb-git-17146fc93d49fc4354f791f9c269fc21d5000eb6.tar.gz
Update readline to version 5.2. This fixes bug#18431.
cmd-line-utils/readline/INSTALL: update readline to version 5.2 cmd-line-utils/readline/README: update readline to version 5.2 cmd-line-utils/readline/bind.c: update readline to version 5.2 cmd-line-utils/readline/callback.c: update readline to version 5.2 cmd-line-utils/readline/chardefs.h: update readline to version 5.2 cmd-line-utils/readline/compat.c: update readline to version 5.2 cmd-line-utils/readline/complete.c: update readline to version 5.2 cmd-line-utils/readline/configure.in: update readline to version 5.2 cmd-line-utils/readline/display.c: update readline to version 5.2 cmd-line-utils/readline/funmap.c: update readline to version 5.2 cmd-line-utils/readline/histexpand.c: update readline to version 5.2 cmd-line-utils/readline/histfile.c: update readline to version 5.2 cmd-line-utils/readline/history.c: update readline to version 5.2 cmd-line-utils/readline/histsearch.c: update readline to version 5.2 cmd-line-utils/readline/input.c: update readline to version 5.2 cmd-line-utils/readline/isearch.c: update readline to version 5.2 cmd-line-utils/readline/keymaps.c: update readline to version 5.2 cmd-line-utils/readline/kill.c: update readline to version 5.2 cmd-line-utils/readline/macro.c: update readline to version 5.2 cmd-line-utils/readline/mbutil.c: update readline to version 5.2 cmd-line-utils/readline/misc.c: update readline to version 5.2 cmd-line-utils/readline/nls.c: update readline to version 5.2 cmd-line-utils/readline/parens.c: update readline to version 5.2 cmd-line-utils/readline/readline.c: update readline to version 5.2 cmd-line-utils/readline/readline.h: update readline to version 5.2 cmd-line-utils/readline/rlconf.h: update readline to version 5.2 cmd-line-utils/readline/rldefs.h: update readline to version 5.2 cmd-line-utils/readline/rlmbutil.h: update readline to version 5.2 cmd-line-utils/readline/rlprivate.h: update readline to version 5.2 cmd-line-utils/readline/rltty.c: update readline to version 5.2 cmd-line-utils/readline/savestring.c: update readline to version 5.2 cmd-line-utils/readline/search.c: update readline to version 5.2 cmd-line-utils/readline/shell.c: update readline to version 5.2 cmd-line-utils/readline/signals.c: update readline to version 5.2 cmd-line-utils/readline/terminal.c: update readline to version 5.2 cmd-line-utils/readline/text.c: update readline to version 5.2 cmd-line-utils/readline/tilde.c: update readline to version 5.2 cmd-line-utils/readline/tilde.h: update readline to version 5.2 cmd-line-utils/readline/undo.c: update readline to version 5.2 cmd-line-utils/readline/util.c: update readline to version 5.2 cmd-line-utils/readline/vi_keymap.c: update readline to version 5.2 cmd-line-utils/readline/vi_mode.c: update readline to version 5.2 cmd-line-utils/readline/xmalloc.c: update readline to version 5.2
Diffstat (limited to 'cmd-line-utils/readline/input.c')
-rw-r--r--cmd-line-utils/readline/input.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/cmd-line-utils/readline/input.c b/cmd-line-utils/readline/input.c
index 818f2e8763d..da5d771c481 100644
--- a/cmd-line-utils/readline/input.c
+++ b/cmd-line-utils/readline/input.c
@@ -1,6 +1,6 @@
/* input.c -- character input functions for readline. */
-/* Copyright (C) 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1994-2005 Free Software Foundation, Inc.
This file is part of the GNU Readline Library, a library for
reading lines of text with interactive input and history editing.
@@ -25,7 +25,9 @@
# include <floss.h>
#endif
-#include "config_readline.h"
+#if defined (HAVE_CONFIG_H)
+# include <config.h>
+#endif
#include <sys/types.h>
#include <fcntl.h>
@@ -177,6 +179,7 @@ rl_gather_tyi ()
struct timeval timeout;
#endif
+ chars_avail = 0;
tty = fileno (rl_instream);
#if defined (HAVE_SELECT)
@@ -218,6 +221,13 @@ rl_gather_tyi ()
}
#endif /* O_NDELAY */
+#if defined (__MINGW32__)
+ /* Use getch/_kbhit to check for available console input, in the same way
+ that we read it normally. */
+ chars_avail = isatty (tty) ? _kbhit () : 0;
+ result = 0;
+#endif
+
/* If there's nothing available, don't waste time trying to read
something. */
if (chars_avail <= 0)
@@ -261,7 +271,7 @@ rl_set_keyboard_input_timeout (u)
int o;
o = _keyboard_input_timeout;
- if (u > 0)
+ if (u >= 0)
_keyboard_input_timeout = u;
return (o);
}
@@ -303,6 +313,11 @@ _rl_input_available ()
#endif
+#if defined (__MINGW32__)
+ if (isatty (tty))
+ return (_kbhit ());
+#endif
+
return 0;
}
@@ -405,7 +420,7 @@ rl_read_key ()
else
{
/* If input is coming from a macro, then use that. */
- if ((c= _rl_next_macro_key ()))
+ if (c = _rl_next_macro_key ())
return (c);
/* If the user has an event function, then call it periodically. */
@@ -442,6 +457,10 @@ rl_getc (stream)
while (1)
{
+#if defined (__MINGW32__)
+ if (isatty (fileno (stream)))
+ return (getch ());
+#endif
result = read (fileno (stream), &c, sizeof (unsigned char));
if (result == sizeof (unsigned char))
@@ -483,7 +502,7 @@ rl_getc (stream)
this is simply an interrupted system call to read ().
Otherwise, some error ocurred, also signifying EOF. */
if (errno != EINTR)
- return (EOF);
+ return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
}
}
@@ -517,6 +536,12 @@ _rl_read_mbchar (mbchar, size)
ps = ps_back;
continue;
}
+ else if (mbchar_bytes_length == 0)
+ {
+ mbchar[0] = '\0'; /* null wide character */
+ mb_len = 1;
+ break;
+ }
else if (mbchar_bytes_length > (size_t)(0))
break;
}
@@ -525,21 +550,21 @@ _rl_read_mbchar (mbchar, size)
}
/* Read a multibyte-character string whose first character is FIRST into
- the buffer MB of length MBLEN. Returns the last character read, which
+ the buffer MB of length MLEN. Returns the last character read, which
may be FIRST. Used by the search functions, among others. Very similar
to _rl_read_mbchar. */
int
-_rl_read_mbstring (first, mb, mb_len)
+_rl_read_mbstring (first, mb, mlen)
int first;
char *mb;
- int mb_len;
+ int mlen;
{
int i, c;
mbstate_t ps;
c = first;
- memset (mb, 0, mb_len);
- for (i = 0; i < mb_len; i++)
+ memset (mb, 0, mlen);
+ for (i = 0; i < mlen; i++)
{
mb[i] = (char)c;
memset (&ps, 0, sizeof (mbstate_t));