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_set.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'sapi/phpdbg/phpdbg_set.c') diff --git a/sapi/phpdbg/phpdbg_set.c b/sapi/phpdbg/phpdbg_set.c index f91156a452..5af2c593c8 100644 --- a/sapi/phpdbg/phpdbg_set.c +++ b/sapi/phpdbg/phpdbg_set.c @@ -32,6 +32,7 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg); const phpdbg_command_t phpdbg_set_commands[] = { PHPDBG_SET_COMMAND_D(prompt, "usage: set prompt []", 'p', set_prompt, NULL, "|s", 0), + PHPDBG_SET_COMMAND_D(pagination, "usage: set pagination []", 'P', set_pagination, NULL, "|b", PHPDBG_ASYNC_SAFE), #ifndef _WIN32 PHPDBG_SET_COMMAND_D(color, "usage: set color ", 'c', set_color, NULL, "ss", PHPDBG_ASYNC_SAFE), PHPDBG_SET_COMMAND_D(colors, "usage: set colors []", 'C', set_colors, NULL, "|b", PHPDBG_ASYNC_SAFE), @@ -42,6 +43,7 @@ const phpdbg_command_t phpdbg_set_commands[] = { PHPDBG_SET_COMMAND_D(quiet, "usage: set quiet []", 'q', set_quiet, NULL, "|b", PHPDBG_ASYNC_SAFE), PHPDBG_SET_COMMAND_D(stepping, "usage: set stepping []", 's', set_stepping, NULL, "|s", PHPDBG_ASYNC_SAFE), PHPDBG_SET_COMMAND_D(refcount, "usage: set refcount []", 'r', set_refcount, NULL, "|b", PHPDBG_ASYNC_SAFE), + PHPDBG_SET_COMMAND_D(lines, "usage: set lines []", 'l', set_lines, NULL, "|l", PHPDBG_ASYNC_SAFE), PHPDBG_END_COMMAND }; @@ -56,6 +58,42 @@ PHPDBG_SET(prompt) /* {{{ */ return SUCCESS; } /* }}} */ +PHPDBG_SET(pagination) /* {{{ */ +{ + if (!param || param->type == EMPTY_PARAM) { + phpdbg_writeln("setpagination", "active=\"%s\"", "Pagination %s", PHPDBG_G(flags) & PHPDBG_HAS_PAGINATION ? "on" : "off"); + } else switch (param->type) { + case NUMERIC_PARAM: { + if (param->num) { + PHPDBG_G(flags) |= PHPDBG_HAS_PAGINATION; + } else { + PHPDBG_G(flags) &= ~PHPDBG_HAS_PAGINATION; + } + } break; + + default: + phpdbg_error("setpagination", "type=\"wrongargs\"", "set pagination used incorrectly: set pagination "); + } + + return SUCCESS; +} /* }}} */ + +PHPDBG_SET(lines) /* {{{ */ +{ + if (!param || param->type == EMPTY_PARAM) { + phpdbg_writeln("setlines", "active=\"%s\"", "Lines %ld", PHPDBG_G(lines)); + } else switch (param->type) { + case NUMERIC_PARAM: { + PHPDBG_G(lines) = param->num; + } break; + + default: + phpdbg_error("setlines", "type=\"wrongargs\"", "set lines used incorrectly: set lines "); + } + + return SUCCESS; +} /* }}} */ + PHPDBG_SET(break) /* {{{ */ { switch (param->type) { -- cgit v1.2.1