about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTDOS.c
diff options
context:
space:
mode:
Diffstat (limited to 'WWW/Library/Implementation/HTDOS.c')
-rw-r--r--WWW/Library/Implementation/HTDOS.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c
index 8ec1caf5..bbdd36e1 100644
--- a/WWW/Library/Implementation/HTDOS.c
+++ b/WWW/Library/Implementation/HTDOS.c
@@ -135,3 +135,43 @@ char * HTDOS_name ARGS1(char *, wwwname)
     return (ret);
 }
 
+#if defined(DJGPP) && defined(DJGPP_KEYHANDLER)
+/* PUBLIC       getxkey()
+**              Replaces libc's getxkey() with polling of tcp/ip
+**              library (WatTcp or Watt-32). This is required to
+**              be able to finish off dead sockets, answer pings etc.
+**
+** ON EXIT:
+**      returns extended keypress.
+*/
+
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+#include <dpmi.h>
+#include <libc/farptrgs.h>
+#include <go32.h>
+
+int getxkey (void)
+{
+    __dpmi_regs r;
+
+    /* poll tcp/ip lib and yield to DPMI-host while nothing in
+     * keyboard buffer (head = tail) (simpler than kbhit).
+     */
+    while (_farpeekw(_dos_ds, 0x41a) == _farpeekw(_dos_ds, 0x41c))
+    {
+	tcp_tick (NULL);
+	__dpmi_yield();
+    }
+
+    r.h.ah = 0x10;
+    __dpmi_int(0x16, &r);
+
+    if (r.h.al == 0x00)
+	return 0x0100 | r.h.ah;
+    if (r.h.al == 0xe0)
+	return 0x0200 | r.h.ah;
+    return r.h.al;
+}
+#endif /* DJGPP && DJGPP_KEYHANDLER */
+