summaryrefslogtreecommitdiff
path: root/readline
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-11-28 04:47:47 +0200
committermonty@donna.mysql.com <>2000-11-28 04:47:47 +0200
commit74e7ffe9872e74f3ac1ae4e93a2ef1b0d2c97c03 (patch)
treee3d40dd7c6a7e86bd2388da19d59d5a372bf7bb8 /readline
parentad2e43c7d6f4b7bbe5b92830ef11856c7d18b6b5 (diff)
downloadmariadb-git-74e7ffe9872e74f3ac1ae4e93a2ef1b0d2c97c03.tar.gz
New thr_alarm struct for better integration with OS2
Run bootstrap in separate thread Fix bug in FLUSH TABLES table_name
Diffstat (limited to 'readline')
-rw-r--r--readline/input.c100
-rw-r--r--readline/rltty.c7
2 files changed, 106 insertions, 1 deletions
diff --git a/readline/input.c b/readline/input.c
index 2813c1b9903..a9e5c9d143f 100644
--- a/readline/input.c
+++ b/readline/input.c
@@ -171,12 +171,23 @@ rl_unget_char (key)
return (0);
}
+#if defined(__EMX__)
+int waiting_char = -1;
+#endif
+
/* If a character is available to be read, then read it
and stuff it into IBUFFER. Otherwise, just return. */
static void
rl_gather_tyi ()
{
-#if defined (__GO32__)
+#if defined (__EMX__)
+ if (isatty (0) && (waiting_char = _read_kbd(0, 0, 0)) != -1 && ibuffer_space ())
+ {
+ int i;
+ i = (*rl_getc_function) (rl_instream);
+ rl_stuff_char (i);
+ }
+#elif defined (__GO32__)
char input;
if (isatty (0) && kbhit () && ibuffer_space ())
@@ -263,6 +274,10 @@ rl_gather_tyi ()
int
_rl_input_available ()
{
+#if defined (__EMX__)
+ if (isatty (0) && (waiting_char = _read_kbd(0, 0, 0)) != -1)
+ return 1;
+#else /* __EMX__ */
#if defined(HAVE_SELECT)
fd_set readfds, exceptfds;
struct timeval timeout;
@@ -288,6 +303,7 @@ _rl_input_available ()
if (ioctl (tty, FIONREAD, &chars_avail) == 0)
return (chars_avail);
#endif
+#endif /* !__EMX__ */
return 0;
}
@@ -397,6 +413,88 @@ rl_getc (stream)
int result, flags;
unsigned char c;
+#if defined (__EMX__)
+ if (isatty (0))
+ {
+ int key;
+
+ if (waiting_char != -1)
+ {
+ key = waiting_char;
+ waiting_char = -1;
+ }
+ else
+ {
+#ifdef __RSXNT__
+ pc_flush();
+#endif
+ key = _read_kbd(0, 1, 0);
+ }
+
+ while (key == 0)
+ {
+ key |= (_read_kbd(0, 1, 0) << 8);
+ /* printf("<%04X> ", key);
+ fflush(stdout); */
+
+ switch (key)
+ {
+ case 0x4B00: /* left arrow */
+ key = 'B' - 64;
+ break;
+ case 0x4D00: /* right arrow */
+ key = 'F' - 64;
+ break;
+ case 0x7300: /* ctrl left arrow */
+ key = 27;
+ waiting_char = 'B';
+ break;
+ case 0x7400: /* ctrl right arrow */
+ key = 27;
+ waiting_char = 'F';
+ break;
+ case 0x4800: /* up arrow */
+ key = 'P' - 64;
+ break;
+ case 0x5000: /* down arrow */
+ key = 'N' - 64;
+ break;
+ case 0x8D00: /* ctrl up arrow */
+ key = 'R' - 64;
+ break;
+ case 0x9100: /* ctrl down arrow */
+ key = 'S' - 64;
+ break;
+ case 0x4700: /* home key */
+ key = 'A' - 64;
+ break;
+ case 0x4F00: /* end key */
+ key = 'E' - 64;
+ break;
+ case 0x7700: /* ctrl home key */
+ key = 27;
+ waiting_char = '<';
+ break;
+ case 0x7500: /* ctrl end key */
+ key = 27;
+ waiting_char = '>';
+ break;
+ case 0x5300: /* delete key */
+ key = 'D' - 64;
+ break;
+ case 0x5200: /* insert key */
+ key = 'V' - 64;
+ break;
+ default: /* ignore all other special keys, read next */
+ key = _read_kbd(0, 1, 0);
+ break;
+ }
+ }
+
+ return (key & 0xFF);
+ }
+#endif /* __EMX__ */
+
#if defined (__GO32__)
if (isatty (0))
return (getkey () & 0x7F);
diff --git a/readline/rltty.c b/readline/rltty.c
index a5ef938b5c0..b4d0cf127d5 100644
--- a/readline/rltty.c
+++ b/readline/rltty.c
@@ -156,6 +156,13 @@ set_winsize (tty)
if (ioctl (tty, TIOCGWINSZ, &w) == 0)
(void) ioctl (tty, TIOCSWINSZ, &w);
}
+#else
+static void
+set_winsize (tty)
+ int tty;
+{
+// dummy function, required by other code. What should be doing?
+}
#endif /* TIOCGWINSZ */
#if defined (NEW_TTY_DRIVER)