summaryrefslogtreecommitdiffstats
path: root/byterun/terminfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'byterun/terminfo.c')
-rw-r--r--byterun/terminfo.c80
1 files changed, 21 insertions, 59 deletions
diff --git a/byterun/terminfo.c b/byterun/terminfo.c
index 214984892..968355b72 100644
--- a/byterun/terminfo.c
+++ b/byterun/terminfo.c
@@ -6,44 +6,13 @@
#include "io.h"
#include "mlvalues.h"
-#ifdef HAS_TERMINFO
-
-#undef getch
-#include <curses.h>
-#include <term.h>
-
-value terminfo_setup(unit) /* ML */
- value unit;
-{
- if (setupterm(NULL, 1, 1) != 1) failwith("Terminfo.setupterm");
- return Val_unit;
-}
-
-value terminfo_getstr(capa) /* ML */
- value capa;
-{
- char * res = (char *) tigetstr(String_val(capa));
- if (res == (char *)(-1)) raise_not_found();
- return copy_string(res);
-}
-
-value terminfo_getnum(capa) /* ML */
- value capa;
-{
- int res = tigetnum(String_val(capa));
- if (res == -2) raise_not_found();
- return Val_int(res);
-}
-
-#else
-
#ifdef HAS_TERMCAP
#define _BSD /* For DEC OSF1 */
#undef getch
#include <curses.h>
-value terminfo_setup(unit)
+value terminfo_setup(unit) /* ML */
value unit;
{
static buffer[1024];
@@ -51,7 +20,7 @@ value terminfo_setup(unit)
return Val_unit;
}
-value terminfo_getstr(capa)
+value terminfo_getstr(capa) /* ML */
value capa;
{
char buff[1024];
@@ -60,7 +29,7 @@ value terminfo_getstr(capa)
return copy_string(buff);
}
-value terminfo_getnum(capa)
+value terminfo_getnum(capa) /* ML */
value capa;
{
int res = tgetnum(String_val(capa));
@@ -68,6 +37,24 @@ value terminfo_getnum(capa)
return Val_int(res);
}
+static struct channel * terminfo_putc_channel;
+
+static int terminfo_putc(c)
+ int c;
+{
+ putch(terminfo_putc_channel, c);
+ return c;
+}
+
+value terminfo_puts(chan, str, count) /* ML */
+ struct channel * chan;
+ value str, count;
+{
+ terminfo_putc_channel = chan;
+ tputs(String_val(str), Int_val(count), terminfo_putc);
+ return Val_unit;
+}
+
#else
value terminfo_setup(unit)
@@ -91,31 +78,6 @@ value terminfo_getnum(capa)
return Val_unit;
}
-#endif
-#endif
-
-#if defined HAS_TERMINFO || defined HAS_TERMCAP
-
-static struct channel * terminfo_putc_channel;
-
-static int terminfo_putc(c)
- int c;
-{
- putch(terminfo_putc_channel, c);
- return c;
-}
-
-value terminfo_puts(chan, str, count) /* ML */
- struct channel * chan;
- value str, count;
-{
- terminfo_putc_channel = chan;
- tputs(String_val(str), Int_val(count), terminfo_putc);
- return Val_unit;
-}
-
-#else
-
value terminfo_puts(chan, str, count)
struct channel * chan;
value str, count;