summaryrefslogtreecommitdiffstats
path: root/text-utils/more.c
diff options
context:
space:
mode:
authorKarel Zak2007-06-04 15:16:18 +0200
committerKarel Zak2007-06-05 23:35:42 +0200
commit04b7cb3216932decb5ce0f62ace580cd91bc8c2e (patch)
tree503f0a98c47a2f1e72f18698608e9a4eac1bdc99 /text-utils/more.c
parentsys-utils: add note about obsolete ramsize option to rdev.8 (diff)
downloadkernel-qcow2-util-linux-04b7cb3216932decb5ce0f62ace580cd91bc8c2e.tar.gz
kernel-qcow2-util-linux-04b7cb3216932decb5ce0f62ace580cd91bc8c2e.tar.xz
kernel-qcow2-util-linux-04b7cb3216932decb5ce0f62ace580cd91bc8c2e.zip
text-utils: fix the more command compilation against termcap
The build-sys (text-utils/Makefile.am) allows to compile against ncurses and termcap. The termcap version is broken in more.c. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/more.c')
-rw-r--r--text-utils/more.c47
1 files changed, 44 insertions, 3 deletions
diff --git a/text-utils/more.c b/text-utils/more.c
index 982edbece..db2fa4d20 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -167,12 +167,13 @@ struct {
extern char PC; /* pad character */
#ifdef HAVE_NCURSES_H
-#include <ncurses.h>
+# include <ncurses.h>
#elif defined(HAVE_NCURSES_NCURSES_H)
-#include <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> */
static void
my_putstring(char *s) {
@@ -204,6 +205,46 @@ my_tgoto(const char *cap, int col, int row) {
return tparm(cap, col, row);
}
+#elif defined(HAVE_LIBTERMCAP) /* !ncurses */
+
+#include <termcap.h>
+
+char termbuffer[4096];
+char tcbuffer[4096];
+char *strbuf = termbuffer;
+
+static void
+my_putstring(char *s) {
+ tputs (s, 1, putchar);
+}
+
+static void
+my_setupterm(const char *term, int fildes, int *errret) {
+ *errret = tgetent(tcbuffer, term);
+}
+
+static int
+my_tgetnum(char *s, char *ss) {
+ return tgetnum(s);
+}
+
+static int
+my_tgetflag(char *s, char *ss) {
+ return tgetflag(s);
+}
+
+static char *
+my_tgetstr(char *s, char *ss) {
+ return tgetstr(s, &strbuf);
+}
+
+static char *
+my_tgoto(const char *cap, int col, int row) {
+ return tgoto(cap, col, row);
+}
+
+#endif /* HAVE_LIBTERMCAP */
+
static void
idummy(int *kk) {}