summaryrefslogtreecommitdiffstats
path: root/misc-utils/cal.c
diff options
context:
space:
mode:
authorKarel Zak2017-05-30 17:10:40 +0200
committerKarel Zak2017-05-30 17:14:46 +0200
commit18451b2cf47191aa5f87d8829f9de22a52eca2e1 (patch)
tree9ec6103a1f6cfb7f3f5e4cdc867ab72b3d491159 /misc-utils/cal.c
parentlib/colors: ncurses cleanup (diff)
downloadkernel-qcow2-util-linux-18451b2cf47191aa5f87d8829f9de22a52eca2e1.tar.gz
kernel-qcow2-util-linux-18451b2cf47191aa5f87d8829f9de22a52eca2e1.tar.xz
kernel-qcow2-util-linux-18451b2cf47191aa5f87d8829f9de22a52eca2e1.zip
cal: ncurses cleanup
* use proper paths to term.h * keep ncurses support optional * link with TINFO_LIBS (-ltinfo), or fallback to NCURSES_LIBS (-ltinfo -lncurses) * don't include unnecessary ncurses.h (term.h is enough) Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/cal.c')
-rw-r--r--misc-utils/cal.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 68c2a3da9..2b16979db 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -80,12 +80,13 @@ static int has_term = 0;
static const char *Senter = "", *Sexit = ""; /* enter and exit standout mode */
#if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW)
-# ifdef HAVE_NCURSES_H
-# include <ncurses.h>
-# elif defined(HAVE_NCURSES_NCURSES_H)
-# include <ncurses/ncurses.h>
+# ifdef HAVE_TERM_H
+# include <term.h>
+# elif defined(HAVE_NCURSES_TERM_H)
+# include <ncurses/term.h>
+# elif defined(HAVE_NCURSESW_TERM_H)
+# include <ncursesw/term.h>
# endif
-# include <term.h>
#endif
static int setup_terminal(char *term
@@ -97,7 +98,7 @@ static int setup_terminal(char *term
#if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW)
int ret;
- if (setupterm(term, STDOUT_FILENO, &ret) != OK || ret != 1)
+ if (setupterm(term, STDOUT_FILENO, &ret) != 0 || ret != 1)
return -1;
#endif
return 0;
@@ -114,7 +115,7 @@ static void my_putstring(char *s)
}
static const char *my_tgetstr(char *ss
- #if !defined(HAVE_LIBNCURSES) && !defined(HAVE_LIBNCURSESW)
+#if !defined(HAVE_LIBNCURSES) && !defined(HAVE_LIBNCURSESW)
__attribute__((__unused__))
#endif
)