From 977253bc89f187cdda4ee3a0c5cdb27777d98b5f Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Fri, 16 Jul 2010 17:45:54 +0200 Subject: [PATCH] Use tcgetattr() instead of ioctl() for portability --- configure.ac | 2 +- test/framework.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index cc6959cc9..589a2a55e 100644 --- a/configure.ac +++ b/configure.ac @@ -172,7 +172,7 @@ AC_HEADER_TIME AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(ctype.h pwd.h stdlib.h string.h strings.h sys/time.h sys/mman.h) -AC_CHECK_HEADERS(sys/ioctl.h termios.h) +AC_CHECK_HEADERS(termios.h) AC_CHECK_FUNCS(asprintf) AC_CHECK_FUNCS(gethostname) diff --git a/test/framework.c b/test/framework.c index 5e01c02ef..e6fcc4822 100644 --- a/test/framework.c +++ b/test/framework.c @@ -19,10 +19,9 @@ #include "ccache.h" #include "framework.h" #include -#if defined(HAVE_TERMIOS_H) && defined(HAVE_SYS_IOCTL_H) +#if defined(HAVE_TERMIOS_H) #define USE_COLOR #include -#include #endif static unsigned passed_asserts; @@ -48,7 +47,7 @@ is_tty(int fd) { #ifdef USE_COLOR struct termios t; - return ioctl(fd, TCGETS, &t) == 0; + return tcgetattr(fd, &t) == 0; #else (void)fd; return 0; -- 2.47.3