]> granicus.if.org Git - php/commitdiff
fix bugsnet #67212: phpdbg uses non-standard TIOCGWINSZ
authorkovacs.ferenc <kovacs.ferenc@ustream.tv>
Sat, 14 Jun 2014 21:48:17 +0000 (23:48 +0200)
committerkovacs.ferenc <kovacs.ferenc@ustream.tv>
Sat, 14 Jun 2014 21:48:24 +0000 (23:48 +0200)
config.m4
phpdbg_utils.c

index ecac17150673dd126eeba0d24947331adfb29236..1a6640eaca280d1aa91660f5355b310ef3f5e32d 100644 (file)
--- 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
index c77ecba564df419fccf40b202e37b096b6ec5fe4..98748b202a12dcbb8e8f8e086aa5e3aec2a878a2 100644 (file)
@@ -32,6 +32,9 @@
 #      include "win32/time.h"
 #elif defined(HAVE_SYS_IOCTL_H) 
 #      include "sys/ioctl.h"
+#      ifndef GWINSZ_IN_SYS_IOCTL
+#              include <termios.h>
+#      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;