com php-src: fix bugsnet #67212: phpdbg uses non-standard TIOCGWINSZ: config.m4 phpdbg_utils.c
| From: | Bob Weinand | Date: | Sat, 14 Jun 2014 21:48:24 +0000 |
| Subject: | com php-src: fix bugsnet #67212: phpdbg uses non-standard TIOCGWINSZ: config.m4 phpdbg_utils.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78880@lists.php.net to get a copy of this message | ||
Commit: e9c2e7d6e630ae660b6b5dc7269af58d4bf7bf54
Author: kovacs.ferenc <kovacs.ferenc@ustream.tv> Sat, 14 Jun 2014 23:48:17 +0200
Parents: fbb7bdc21e0bd869dd25a701d49d8daaf8ffe03a
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e9c2e7d6e630ae660b6b5dc7269af58d4bf7bf54
Log:
fix bugsnet #67212: phpdbg uses non-standard TIOCGWINSZ
Bugs:
https://bugs.php.net/67212
Changed paths:
M config.m4
M phpdbg_utils.c
Diff:
diff --git a/config.m4 b/config.m4
index ecac171..1a6640e 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 c77ecba..98748b2 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 <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;