From 26e1d57e8cfb3b8860ba89b66643e14cbef9edcc Mon Sep 17 00:00:00 2001 From: krakjoe Date: Thu, 28 Nov 2013 17:02:38 +0000 Subject: add set colors command to assist remote console --- phpdbg_set.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'phpdbg_set.c') diff --git a/phpdbg_set.c b/phpdbg_set.c index aa24822b9e..be8624ef97 100644 --- a/phpdbg_set.c +++ b/phpdbg_set.c @@ -57,7 +57,9 @@ PHPDBG_SET(break) /* {{{ */ } break; - phpdbg_default_switch_case(); + default: + phpdbg_error( + "set break used incorrectly: set break "); } return SUCCESS; @@ -71,6 +73,7 @@ PHPDBG_SET(color) /* {{{ */ input->argv[2]->string, input->argv[2]->length TSRMLS_CC); int element = PHPDBG_COLOR_INVALID; + /* @TODO(anyone) make this consistent with other set commands */ if (color) { if (phpdbg_argv_is(1, "prompt")) { phpdbg_notice( @@ -105,6 +108,34 @@ usage: } return SUCCESS; } /* }}} */ + +PHPDBG_SET(colors) /* {{{ */ +{ + switch (param->type) { + case EMPTY_PARAM: { + phpdbg_writeln( + "%s", PHPDBG_G(flags) & PHPDBG_IS_COLOURED ? "on" : "off"); + goto done; + } + + case STR_PARAM: { + if (strncasecmp(param->str, PHPDBG_STRL("on")) == 0) { + PHPDBG_G(flags) |= PHPDBG_IS_COLOURED; + goto done; + } else if (strncasecmp(param->str, PHPDBG_STRL("off")) == 0) { + PHPDBG_G(flags) &= ~PHPDBG_IS_COLOURED; + goto done; + } + } + } + +usage: + phpdbg_error( + "set colors used incorrectly: set colors "); + +done: + return SUCCESS; +} /* }}} */ #endif PHPDBG_SET(oplog) /* {{{ */ -- cgit v1.2.1