aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meson.build9
-rw-r--r--meson_options.txt4
-rw-r--r--src/libeinfo/libeinfo.c81
-rw-r--r--src/libeinfo/meson.build2
4 files changed, 17 insertions, 79 deletions
diff --git a/meson.build b/meson.build
index 4e330d33..93186887 100644
--- a/meson.build
+++ b/meson.build
@@ -126,15 +126,6 @@ else
cc_selinux_flags = []
endif
-termcap = get_option('termcap')
-if termcap != ''
- termcap_dep = dependency(termcap)
- termcap_flags = '-DHAVE_TERMCAP'
- else
- termcap_dep = []
- termcap_flags = []
-endif
-
if get_option('buildtype').startswith('debug')
cc_debug_flags = ['-DRC_DEBUG']
else
diff --git a/meson_options.txt b/meson_options.txt
index 1f38efbb..c0a6ffa9 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -28,9 +28,5 @@ option('shell', type : 'string', value : '/bin/sh',
description : 'Default posix compatible shell')
option('sysvinit', type : 'boolean', value : false,
description : 'enable SysVinit compatibility (linux only)')
-option('termcap', type : 'combo',
- choices :
- [ '', 'ncurses', 'termcap' ],
- description : 'the termcap library to use')
option('zsh-completions', type : 'boolean',
description : 'install zsh completions')
diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c
index 840233bd..7e86091e 100644
--- a/src/libeinfo/libeinfo.c
+++ b/src/libeinfo/libeinfo.c
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (c) 2007-2015 The OpenRC Authors.
+ * Copyright (c) 2007-2024 The OpenRC Authors.
* See the Authors file at the top-level directory of this distribution and
* https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
*
@@ -26,9 +26,6 @@
#include <string.h>
#include <strings.h>
#include <syslog.h>
-#ifdef HAVE_TERMCAP
-# include <termcap.h>
-#endif
#include <unistd.h>
#include "einfo.h"
@@ -97,12 +94,6 @@ static char *goto_column = NULL;
static const char *term = NULL;
static bool term_is_cons25 = false;
-/* Termcap buffers and pointers
- * Static buffers suck hard, but some termcap implementations require them */
-#ifdef HAVE_TERMCAP
-static char termcapbuf[2048];
-static char tcapbuf[512];
-#else
/* No curses support, so we hardcode a list of colour capable terms
* Only terminals without "color" in the name need to be explicitly listed */
static const char *const color_terms[] = {
@@ -144,7 +135,6 @@ static const char *const color_terms[] = {
"xterm-debian",
NULL
};
-#endif
#ifndef HAVE_STRLCPY
static size_t
@@ -236,7 +226,6 @@ is_verbose(void)
}
/* Fake tgoto call - very crapy, but works for our needs */
-#ifndef HAVE_TERMCAP
static char *
tgoto(const char *cap, int col, int line)
{
@@ -299,7 +288,6 @@ tgoto(const char *cap, int col, int line)
*p = '\0';
return buf;
}
-#endif
static bool
colour_terminal(FILE * EINFO_RESTRICT f)
@@ -312,9 +300,6 @@ colour_terminal(FILE * EINFO_RESTRICT f)
const char *bold;
char tmp[100];
unsigned int i = 0;
-#ifdef HAVE_TERMCAP
- char *bp;
-#endif
if (f && !isatty(fileno(f)))
return false;
@@ -336,65 +321,33 @@ colour_terminal(FILE * EINFO_RESTRICT f)
if (strcmp(term, "cons25") == 0)
term_is_cons25 = true;
-#ifdef HAVE_TERMCAP
- /* Check termcap to see if we can do colour or not */
- if (tgetent(termcapbuf, term) == 1) {
- bp = tcapbuf;
- _af = tgetstr("AF", &bp);
- _ce = tgetstr("ce", &bp);
- _ch = tgetstr("ch", &bp);
- /* Our ch use also works with RI .... for now */
- if (!_ch)
- _ch = tgetstr("RI", &bp);
- _md = tgetstr("md", &bp);
- _me = tgetstr("me", &bp);
- _up = tgetstr("up", &bp);
- }
+ if (strstr(term, "color"))
+ in_colour = 1;
- /* Cheat here as vanilla BSD has the whole termcap info in /usr
- * which is not available to us when we boot */
- if (term_is_cons25 || strcmp(term, "wsvt25") == 0) {
-#else
- if (strstr(term, "color"))
+ while (color_terms[i] && in_colour != 1) {
+ if (strcmp(color_terms[i], term) == 0) {
in_colour = 1;
-
- while (color_terms[i] && in_colour != 1) {
- if (strcmp(color_terms[i], term) == 0) {
- in_colour = 1;
- }
- i++;
- }
-
- if (in_colour != 1) {
- in_colour = 0;
- return false;
}
-#endif
- if (!_af)
- _af = AF;
- if (!_ce)
- _ce = CE;
- if (!_ch)
- _ch = CH;
- if (!_md)
- _md = MD;
- if (!_me)
- _me = ME;
- if (!_up)
- _up = UP;
-#ifdef HAVE_TERMCAP
+ i++;
}
- if (!_af || !_ce || !_me || !_md || !_up) {
+ if (in_colour != 1) {
in_colour = 0;
return false;
}
- /* Many termcap databases don't have ch or RI even though they
- * do work */
+ if (!_af)
+ _af = AF;
+ if (!_ce)
+ _ce = CE;
if (!_ch)
_ch = CH;
-#endif
+ if (!_md)
+ _md = MD;
+ if (!_me)
+ _me = ME;
+ if (!_up)
+ _up = UP;
/* Now setup our colours */
p = ebuffer;
diff --git a/src/libeinfo/meson.build b/src/libeinfo/meson.build
index 16e82978..6ee923cc 100644
--- a/src/libeinfo/meson.build
+++ b/src/libeinfo/meson.build
@@ -1,9 +1,7 @@
libeinfo_version = '1'
libeinfo = library('einfo', ['libeinfo.c'],
- c_args : termcap_flags,
include_directories : incdir,
- dependencies : termcap_dep,
link_depends : 'einfo.map',
version : libeinfo_version,
install : true,