From e9c2e7d6e630ae660b6b5dc7269af58d4bf7bf54 Mon Sep 17 00:00:00 2001 From: "kovacs.ferenc" Date: Sat, 14 Jun 2014 23:48:17 +0200 Subject: [PATCH] fix bugsnet #67212: phpdbg uses non-standard TIOCGWINSZ --- config.m4 | 1 + phpdbg_utils.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config.m4 b/config.m4 index ecac171506..1a6640eaca 100644 --- a/config.m4 +++ b/config.m4 @@ -9,6 +9,7 @@ PHP_ARG_ENABLE(phpdbg-debug, for phpdbg debug build, [ --enable-phpdbg-debug Build phpdbg in debug mode], no, no) if test "$PHP_PHPDBG" != "no"; then + AC_HEADER_TIOCGWINSZ AC_DEFINE(HAVE_PHPDBG, 1, [ ]) if test "$PHP_PHPDBG_DEBUG" != "no"; then diff --git a/phpdbg_utils.c b/phpdbg_utils.c index c77ecba564..98748b202a 100644 --- a/phpdbg_utils.c +++ b/phpdbg_utils.c @@ -32,6 +32,9 @@ # include "win32/time.h" #elif defined(HAVE_SYS_IOCTL_H) # include "sys/ioctl.h" +# ifndef GWINSZ_IN_SYS_IOCTL +# include +# endif #endif ZEND_EXTERN_MODULE_GLOBALS(phpdbg); @@ -437,7 +440,7 @@ PHPDBG_API int phpdbg_get_terminal_width(TSRMLS_D) /* {{{ */ GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); columns = csbi.srWindow.Right - csbi.srWindow.Left + 1; -#elif defined(HAVE_SYS_IOCTL_H) +#elif defined(HAVE_SYS_IOCTL_H) && defined (TIOCGWINSZ) struct winsize w; columns = ioctl(fileno(stdout), TIOCGWINSZ, &w) == 0 ? w.ws_col : 80; -- 2.40.0