AS_HELP_STRING([--with-termcap],
[Use a termcap library if available [[yes]]]))
: ${with_termcap='yes'}
-if test "x${with_termcap}" = xno; then
- dnl On Unix (in uxtty.c) primitives like tty-command-clear require
- dnl some kind of termcap. A build without-termcap is not possible.
- AC_MSG_ERROR([--without-termcap is not supported on Unix systems])
-fi
dnl For reasons I don't understand, it is necessary to use
dnl quadigraphs here instead of [[ ... ]].
dnl by pretending we know the format -- without bringing in the local
dnl termcap reimplementation.
-dnl Go for whatever header files we can.
-AC_CHECK_HEADERS([ncurses.h curses.h term.h termcap.h])
-
if test "x${with_termcap}" = xyes; then
+ AC_DEFINE([USE_TERMCAP], [1], [Define if termcap should be used.])
+ AC_CHECK_HEADERS([ncurses.h curses.h term.h termcap.h])
AC_CHECK_LIB([ncurses], [tgetent], [have_ncurses=yes])
AC_CHECK_LIB([ncurses], [tparm], [have_ncurses_tparm=yes])
AC_CHECK_LIB([ncurses], [tparam], [have_ncurses_tparam=yes])
elif test "x${with_termcap}" != xno; then
+ AC_DEFINE([USE_TERMCAP], [1], [Define if termcap should be used.])
+ AC_CHECK_HEADERS([ncurses.h curses.h term.h termcap.h])
lib=${with_termcap}
AC_CHECK_LIB([${lib}], [tgetent], [eval have_${lib}=yes])
AC_CHECK_LIB([${lib}], [tparm], [eval have_${lib}_tparm=yes])
case "${with_termcap}" in
yes)
AC_MSG_WARN([No termcap library found; will emulate it])
- OPTIONAL_BASES="${OPTIONAL_BASES} termcap tparam"
+ OPTIONAL_BASES="${OPTIONAL_BASES} termcap tparam tterm"
+ ;;
+no)
+ AC_MSG_NOTICE([Termcap disabled.])
;;
-no) ;;
*)
LIBS="-l${with_termcap} ${LIBS}"
eval have_tparam=\$have_${with_termcap}_tparam
eval have_tparm=\$have_${with_termcap}_tparm
if test "x${have_tparm}" = xyes; then
AC_MSG_WARN([No tparam found; will emulate it from terminfo tparm])
- OPTIONAL_BASES="${OPTIONAL_BASES} terminfo"
+ OPTIONAL_BASES="${OPTIONAL_BASES} terminfo tterm"
else
AC_MSG_WARN([No tparam found; will emulate it])
- OPTIONAL_BASES="${OPTIONAL_BASES} tparam"
+ OPTIONAL_BASES="${OPTIONAL_BASES} tparam tterm"
fi
fi
;;
{
PRIMITIVE_HEADER (1);
{
+#ifdef USE_TERMCAP
int result = (tgetnum (STRING_ARG (1)));
PRIMITIVE_RETURN ((result < 0) ? SHARP_F : (long_to_integer (result)));
+#else
+ PRIMITIVE_RETURN (SHARP_F);
+#endif
}
}
DEFINE_PRIMITIVE ("TERMCAP-GET-FLAG", Prim_termcap_get_flag, 1, 1, 0)
{
PRIMITIVE_HEADER (1);
+#ifdef USE_TERMCAP
PRIMITIVE_RETURN (BOOLEAN_TO_OBJECT ((tgetflag (STRING_ARG (1))) != 0));
+#else
+ PRIMITIVE_RETURN (SHARP_F);
+#endif
}
DEFINE_PRIMITIVE ("TERMCAP-GET-STRING", Prim_termcap_get_string, 1, 1, 0)
#include "uxterm.h"
extern Tchannel OS_open_fd (int fd);
+#ifdef USE_TERMCAP
extern int tgetent (void *, const char *);
extern int tgetnum (const char *);
extern const char * tgetstr (const char *, char **);
extern void tputs (const char *, int, void (*) (char));
+#endif
\f
/* Standard Input and Output */
#endif /* not TIOCGWINSZ */
#endif /* TIOCGSIZE */
+#ifdef USE_TERMCAP
static char tputs_output [TERMCAP_BUFFER_SIZE];
static char * tputs_output_scan;
tty_x_size = (tgetnum ("co"));
tty_y_size = (tgetnum ("li"));
}
+#endif /* USE_TERMCAP */
static void
UX_synchronize_tty_size (void)
}
}
+#ifdef USE_TERMCAP
if ((tty_x_size <= 0) || (tty_y_size <= 0))
UX_tty_with_termcap (&UX_synchronize_tty_size_with_termcap);
+#endif
if ((tty_x_size <= 0) || (tty_y_size <= 0))
{
tty_size_synchronized_p = true;
}
\f
+#ifdef USE_TERMCAP
static void
UX_initialize_tty_with_termcap (void)
{
char *tbp = tgetstr_buffer;
tty_command_clear = (tgetstr ("cl", (&tbp)));
}
+#endif
void
UX_initialize_tty (void)
tty_size_synchronized_p = false;
UX_synchronize_tty_size ();
tty_command_beep = ALERT_STRING;
+#ifndef USE_TERMCAP
+ tty_command_clear = "\f";
+#else
tty_command_clear = 0;
UX_tty_with_termcap (&UX_initialize_tty_with_termcap);
if (tty_command_clear == 0)
(*tputs_output_scan++) = '\0';
tty_command_clear = command;
}
+#endif
}
void