diff options
author | No author <no_author@ocaml.org> | 1995-06-15 16:08:54 +0000 |
---|---|---|
committer | No author <no_author@ocaml.org> | 1995-06-15 16:08:54 +0000 |
commit | 77b1c8b89fd8940a63b17c41eb37161e5d159831 (patch) | |
tree | 43dbfb3982d9166b717199cb8faa97bdce30add7 /byterun/terminfo.c | |
parent | ba79d4bd1f01a70b892c69f6a5e6e86714a023d6 (diff) | |
download | ocaml-unlabeled-1.2.2.tar.gz |
This commit was manufactured by cvs2svn to create branchunlabeled-1.2.2
'unlabeled-1.2.2'.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/unlabeled-1.2.2@37 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/terminfo.c')
-rw-r--r-- | byterun/terminfo.c | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/byterun/terminfo.c b/byterun/terminfo.c deleted file mode 100644 index 214984892f..0000000000 --- a/byterun/terminfo.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Read and output terminal commands */ - -#include "config.h" -#include "alloc.h" -#include "fail.h" -#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 unit; -{ - static buffer[1024]; - if (tgetent(buffer, getenv("TERM")) != 1) failwith("Terminfo.setupterm"); - return Val_unit; -} - -value terminfo_getstr(capa) - value capa; -{ - char buff[1024]; - char * p = buff; - if (tgetstr(String_val(capa), &p) == 0) raise_not_found(); - return copy_string(buff); -} - -value terminfo_getnum(capa) - value capa; -{ - int res = tgetnum(String_val(capa)); - if (res == -1) raise_not_found(); - return Val_int(res); -} - -#else - -value terminfo_setup(unit) - value unit; -{ - failwith("Terminfo.setupterm"); - return Val_unit; -} - -value terminfo_getstr(capa) - value capa; -{ - raise_not_found(); - return Val_unit; -} - -value terminfo_getnum(capa) - value capa; -{ - raise_not_found(); - 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; -{ - invalid_argument("Terminfo.puts"); -} - -#endif |