diff options
author | Felipe Pena <felipensp@gmail.com> | 2015-10-18 12:08:04 -0200 |
---|---|---|
committer | Felipe Pena <felipensp@gmail.com> | 2015-10-18 12:08:04 -0200 |
commit | f231ddddafa005576e90f9325d31eebc9ea690bf (patch) | |
tree | 38452a7e230501a6e01fcd3206355005e9745343 /sapi/phpdbg/phpdbg_utils.c | |
parent | daddb7a832309bb26858d3c069ecf29c0994dbd7 (diff) | |
download | php-git-f231ddddafa005576e90f9325d31eebc9ea690bf.tar.gz |
- Implemented output paging
Diffstat (limited to 'sapi/phpdbg/phpdbg_utils.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_utils.c | 18 |
1 files changed, 18 insertions, 0 deletions
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; |