From 58149472adcbd8f307e2ed9ff3892bd47fbe4658 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 9 Jun 2016 11:39:24 +0200 Subject: [PATCH] cal: cleanup non-ncurses build --- misc-utils/cal.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 8405cd15f1..2808793824 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -88,7 +88,11 @@ static const char *Senter = "", *Sexit = ""; /* enter and exit standout mode */ # include #endif -static int setup_terminal(char *term) +static int setup_terminal(char *term +#if !defined(HAVE_LIBNCURSES) && !defined(HAVE_LIBNCURSESW) + __attribute__((__unused__)) +#endif + ) { #if defined(HAVE_LIBNCURSES) || defined(HAVE_LIBNCURSESW) int ret; @@ -109,7 +113,11 @@ static void my_putstring(char *s) fputs(s, stdout); } -static const char *my_tgetstr(char *ss) +static const char *my_tgetstr(char *ss + #if !defined(HAVE_LIBNCURSES) && !defined(HAVE_LIBNCURSESW) + __attribute__((__unused__)) +#endif + ) { const char *ret = NULL; @@ -238,6 +246,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out); int main(int argc, char **argv) { struct tm *local_time; + char *term; time_t now; int ch = 0, yflag = 0, Yflag = 0; static struct cal_control ctl = { @@ -284,18 +293,14 @@ int main(int argc, char **argv) textdomain(PACKAGE); atexit(close_stdout); -#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("smso"); - Sexit = my_tgetstr("rmso"); - } + term = getenv("TERM"); + if (term) { + has_term = setup_terminal(term) == 0; + if (has_term) { + Senter = my_tgetstr("smso"); + Sexit = my_tgetstr("rmso"); } } -#endif /* * The traditional Unix cal utility starts the week at Sunday, -- 2.47.2