From: Karel Zak Date: Thu, 9 Jun 2016 09:39:24 +0000 (+0200) Subject: cal: cleanup non-ncurses build X-Git-Tag: v2.29-rc1~190 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58149472adcbd8f307e2ed9ff3892bd47fbe4658;p=thirdparty%2Futil-linux.git cal: cleanup non-ncurses build --- 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,