com php-src: add set colors command to assist remote console: Changelog.md phpdbg_set.c phpdbg_set.h
| From: | Bob Weinand | Date: | Thu, 28 Nov 2013 17:02:38 +0000 |
| Subject: | com php-src: add set colors command to assist remote console: Changelog.md phpdbg_set.c phpdbg_set.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74571@lists.php.net to get a copy of this message | ||
Commit: 26e1d57e8cfb3b8860ba89b66643e14cbef9edcc
Author: krakjoe <joe.watkins@live.co.uk> Thu, 28 Nov 2013 17:02:38 +0000
Parents: b2af85a445b488aae98d7fc9182ab15b4d34bbfd
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=26e1d57e8cfb3b8860ba89b66643e14cbef9edcc
Log:
add set colors command to assist remote console
Changed paths:
M Changelog.md
M phpdbg_set.c
M phpdbg_set.h
Diff:
diff --git a/Changelog.md b/Changelog.md
index 076d2c8..97aa1e9 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -10,6 +10,7 @@ Version 0.2.0 2013-00-00
3. Added "set" command - control prompt and console colors
4. .phpdbginit now searched in (additional) ini dirs
5. Added source command - load additional .phpdbginit script during session
+6. Added remote console mode
Version 0.1.0 2013-11-23
------------------------
diff --git a/phpdbg_set.c b/phpdbg_set.c
index aa24822..be8624e 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 <on|off>");
}
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 <on|off>");
+
+done:
+ return SUCCESS;
+} /* }}} */
#endif
PHPDBG_SET(oplog) /* {{{ */
diff --git a/phpdbg_set.h b/phpdbg_set.h
index b18da48..35b61d4 100644
--- a/phpdbg_set.h
+++ b/phpdbg_set.h
@@ -27,6 +27,7 @@
PHPDBG_SET(prompt);
#ifndef _WIN32
PHPDBG_SET(color);
+PHPDBG_SET(colors);
#endif
PHPDBG_SET(oplog);
PHPDBG_SET(break);
@@ -35,6 +36,7 @@ static const phpdbg_command_t phpdbg_set_commands[] = {
PHPDBG_COMMAND_D_EX(prompt, "usage: set prompt <string>",
'p', set_prompt, NULL, 0),
#ifndef _WIN32
PHPDBG_COMMAND_D_EX(color, "usage: set color <element> <color>",
'c', set_color, NULL, 1),
+ PHPDBG_COMMAND_D_EX(colors, "usage: set colors <on|off>", 'C',
set_colors, NULL, 1),
#endif
PHPDBG_COMMAND_D_EX(oplog, "usage: set oplog <output>",
'O', set_oplog, NULL, 0),
PHPDBG_COMMAND_D_EX(break, "usage: set break <on|off>",
'b', set_break, NULL, 0),