fix bugsnet #67212: phpdbg uses non-standard TIOCGWINSZ

This commit is contained in:
kovacs.ferenc 2014-06-14 23:48:17 +02:00
parent fbb7bdc21e
commit e9c2e7d6e6
2 changed files with 5 additions and 1 deletions

View File

@ -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

View 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;