summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2014-02-06 14:21:40 +1030
committerRusty Russell <rusty@rustcorp.com.au>2014-02-06 14:21:40 +1030
commite4fbff960f8d384ee793259ff6e13bb798114c98 (patch)
tree62ffacfb3947ff0b7f3def7d5bf08881bd0673c8
parent7471ecd79174306ee976a4ecc09cc2b9ebb4b501 (diff)
opt: test HAVE_SYS_TERMIOS_H via #if
As ccanlint warns. Also, test TIOCGWINSZ before ioctl, rather than the header directly since it's a little orthogonal. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--ccan/opt/usage.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ccan/opt/usage.c b/ccan/opt/usage.c
index ef33f918..ff054559 100644
--- a/ccan/opt/usage.c
+++ b/ccan/opt/usage.c
@@ -1,6 +1,6 @@
/* Licensed under GPLv3+ - see LICENSE file for details */
#include <ccan/opt/opt.h>
-#ifdef HAVE_SYS_TERMIOS_H
+#if HAVE_SYS_TERMIOS_H
#include <sys/ioctl.h>
#include <sys/termios.h> /* Required on Solaris for struct winsize */
#endif
@@ -24,7 +24,8 @@ static unsigned int get_columns(void)
if (env)
ws_col = atoi(env);
-#ifdef HAVE_SYS_TERMIOS_H
+
+#ifdef TIOCGWINSZ
if (!ws_col)
{
struct winsize w;