build-sys: remove libtermcap support

It is unlikely anyone is going to build this project on system where
libtermcap is available.  Fedora project obsoleted libtermcap 2007-12-12 in
favour of ncurses.  Debian made same move 2005.

Reference: https://fedoraproject.org/wiki/Deprecated_packages
Reference: https://www.debian.org/doc/manuals/debian-faq/ch-compat.en.html#s-termcap
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2016-01-16 23:23:04 +00:00 committed by Karel Zak
parent cc706d9f09
commit b4566a8a8d
5 changed files with 33 additions and 152 deletions

View File

@ -580,17 +580,6 @@ AS_IF([test "x$with_util" = xno], [
])
AC_ARG_WITH([termcap], AS_HELP_STRING([--without-termcap], [compile without libtermcap]),
[], [with_termcap=auto]
)
AS_IF([test "x$with_termcap" = xno], [
AM_CONDITIONAL([HAVE_TERMCAP], [false])
have_termcap=no
], [
UL_CHECK_LIB([termcap], [tgetnum])
])
AC_CHECK_TYPES([union semun], [], [], [[
#include <sys/sem.h>
]])

View File

@ -12,9 +12,6 @@ endif
cal_CFLAGS = $(AM_CFLAGS) $(NCURSES_CFLAGS)
cal_LDADD = $(LDADD) libcommon.la libtcolors.la $(NCURSES_LIBS)
if HAVE_TERMCAP
cal_LDADD += -ltermcap
endif
endif # BUILD_CAL

View File

@ -85,78 +85,42 @@ static const char *Senter = "", *Sexit = ""; /* enter and exit standout mode */
# include <ncurses/ncurses.h>
# endif
# include <term.h>
#endif
static int setup_terminal(char *term)
{
#if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW)
int ret;
if (setupterm(term, STDOUT_FILENO, &ret) != OK || ret != 1)
return -1;
#endif
return 0;
}
static void my_putstring(char *s)
{
#if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW)
if (has_term)
putp(s);
else
#endif
fputs(s, stdout);
}
static const char *my_tgetstr(char *s __attribute__((__unused__)), char *ss)
static const char *my_tgetstr(char *s __attribute__ ((__unused__)), char *ss)
{
const char *ret = NULL;
#if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW)
if (has_term)
ret = tigetstr(ss);
#endif
if (!ret || ret == (char *)-1)
return "";
return ret;
}
#elif defined(HAVE_LIBTERMCAP)
# include <termcap.h>
static char termbuffer[4096];
static char tcbuffer[4096];
static char *strbuf = termbuffer;
static int setup_terminal(char *term)
{
if (tgetent(tcbuffer, term) < 0)
return -1;
return 0;
}
static void my_putstring(char *s)
{
if (has_term)
tputs(s, 1, putchar);
else
fputs(s, stdout);
}
static const char *my_tgetstr(char *s, char *ss __attribute__((__unused__)))
{
const char *ret = NULL;
if (has_term)
ret = tgetstr(s, &strbuf);
if (!ret)
return "";
return ret;
}
#else /* ! (HAVE_LIBTERMCAP || HAVE_LIBNCURSES || HAVE_LIBNCURSESW) */
static void my_putstring(char *s)
{
fputs(s, stdout);
}
#endif /* end of LIBTERMCAP / NCURSES */
#include "widechar.h"
enum {
@ -318,15 +282,14 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
atexit(close_stdout);
#if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW) || defined(HAVE_LIBTERMCAP)
#if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW)
{
char *term = getenv("TERM");
if (term) {
has_term = setup_terminal(term) == 0;
if (has_term) {
Senter = my_tgetstr("so","smso");
Sexit = my_tgetstr("se","rmso");
Senter = my_tgetstr("so", "smso");
Sexit = my_tgetstr("se", "rmso");
}
}
}

View File

@ -95,10 +95,6 @@ more_CFLAGS += $(NCURSES_CFLAGS)
more_LDADD += $(NCURSES_LIBS)
endif
if HAVE_TERMCAP
more_LDADD += -ltermcap
endif
check_PROGRAMS += test_more
test_more_SOURCES = $(more_SOURCES)
test_more_CFLAGS = -DTEST_PROGRAM

View File

@ -195,31 +195,29 @@ extern char PC; /* pad character */
#elif defined(HAVE_NCURSES_NCURSES_H)
# include <ncurses/ncurses.h>
#endif
#include <term.h> /* include after <curses.h> */
#if defined(HAVE_NCURSES_H) || defined(HAVE_NCURSES_NCURSES_H)
# include <term.h> /* include after <curses.h> */
# define TERM_AUTO_RIGHT_MARGIN "am"
# define TERM_CEOL "xhp"
# define TERM_CLEAR "clear"
# define TERM_CLEAR_TO_LINE_END "el"
# define TERM_CLEAR_TO_SCREEN_END "ed"
# define TERM_COLS "cols"
# define TERM_CURSOR_ADDRESS "cup"
# define TERM_EAT_NEW_LINE "xenl"
# define TERM_ENTER_UNDERLINE "smul"
# define TERM_EXIT_STANDARD_MODE "rmso"
# define TERM_EXIT_UNDERLINE "rmul"
# define TERM_HARD_COPY "hc"
# define TERM_HOME "home"
# define TERM_LINE_DOWN "cud1"
# define TERM_LINES "lines"
# define TERM_OVER_STRIKE "os"
# define TERM_PAD_CHAR "pad"
# define TERM_STANDARD_MODE "smso"
# define TERM_STD_MODE_GLITCH "xmc"
# define TERM_UNDERLINE_CHAR "uc"
# define TERM_UNDERLINE "ul"
#define TERM_AUTO_RIGHT_MARGIN "am"
#define TERM_CEOL "xhp"
#define TERM_CLEAR "clear"
#define TERM_CLEAR_TO_LINE_END "el"
#define TERM_CLEAR_TO_SCREEN_END "ed"
#define TERM_COLS "cols"
#define TERM_CURSOR_ADDRESS "cup"
#define TERM_EAT_NEW_LINE "xenl"
#define TERM_ENTER_UNDERLINE "smul"
#define TERM_EXIT_STANDARD_MODE "rmso"
#define TERM_EXIT_UNDERLINE "rmul"
#define TERM_HARD_COPY "hc"
#define TERM_HOME "home"
#define TERM_LINE_DOWN "cud1"
#define TERM_LINES "lines"
#define TERM_OVER_STRIKE "os"
#define TERM_PAD_CHAR "pad"
#define TERM_STANDARD_MODE "smso"
#define TERM_STD_MODE_GLITCH "xmc"
#define TERM_UNDERLINE_CHAR "uc"
#define TERM_UNDERLINE "ul"
static void my_putstring(char *s)
{
@ -251,68 +249,6 @@ static char *my_tgoto(char *cap, int col, int row)
return tparm(cap, col, row);
}
#elif defined(HAVE_LIBTERMCAP) /* ncurses not found */
# include <termcap.h>
# define TERM_AUTO_RIGHT_MARGIN "am"
# define TERM_CEOL "xs"
# define TERM_CLEAR "cl"
# define TERM_CLEAR_TO_LINE_END "ce"
# define TERM_CLEAR_TO_SCREEN_END "cd"
# define TERM_COLS "co"
# define TERM_CURSOR_ADDRESS "cm"
# define TERM_EAT_NEW_LINE "xn"
# define TERM_ENTER_UNDERLINE "us"
# define TERM_EXIT_STANDARD_MODE "se"
# define TERM_EXIT_UNDERLINE "ue"
# define TERM_HARD_COPY "hc"
# define TERM_HOME "ho"
# define TERM_LINE_DOWN "le"
# define TERM_LINES "li"
# define TERM_OVER_STRIKE "os"
# define TERM_PAD_CHAR "pc"
# define TERM_STANDARD_MODE "so"
# define TERM_STD_MODE_GLITCH "sg"
# define TERM_UNDERLINE_CHAR "uc"
# define TERM_UNDERLINE "ul"
char termbuffer[TERMINAL_BUF];
char tcbuffer[TERMINAL_BUF];
char *strbuf = termbuffer;
static void my_putstring(char *s)
{
tputs(s, fileno(stdout), putchar);
}
static void my_setupterm(char *term, int fildes __attribute__((__unused__)), int *errret)
{
*errret = tgetent(tcbuffer, term);
}
static int my_tgetnum(char *s)
{
return tgetnum(s);
}
static int my_tgetflag(char *s)
{
return tgetflag(s);
}
static char *my_tgetstr(char *s)
{
return tgetstr(s, &strbuf);
}
static char *my_tgoto(char *cap, int col, int row)
{
return tgoto(cap, col, row);
}
#endif /* HAVE_LIBTERMCAP */
static void __attribute__((__noreturn__)) usage(FILE *out)
{
fputs(USAGE_HEADER, out);