From f231ddddafa005576e90f9325d31eebc9ea690bf Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 18 Oct 2015 12:08:04 -0200 Subject: - Implemented output paging --- sapi/phpdbg/phpdbg_utils.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sapi/phpdbg/phpdbg_utils.c') diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c index e9b30c07b1..92beda3c4f 100644 --- a/sapi/phpdbg/phpdbg_utils.c +++ b/sapi/phpdbg/phpdbg_utils.c @@ -351,6 +351,24 @@ PHPDBG_API int phpdbg_get_terminal_width(void) /* {{{ */ return columns; } /* }}} */ +PHPDBG_API int phpdbg_get_terminal_height(void) /* {{{ */ +{ + int lines; +#ifdef _WIN32 + CONSOLE_SCREEN_BUFFER_INFO csbi; + + GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); + lines = csbi.srWindow.Bottom - csbi.srWindow.Top + 1; +#elif defined(HAVE_SYS_IOCTL_H) && defined(TIOCGWINSZ) + struct winsize w; + + lines = ioctl(fileno(stdout), TIOCGWINSZ, &w) == 0 ? w.ws_row : 40; +#else + lines = 40; +#endif + return lines; +} /* }}} */ + PHPDBG_API void phpdbg_set_async_io(int fd) { #if !defined(_WIN32) && defined(FASYNC) int flags; -- cgit v1.2.1