summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Pena <felipensp@gmail.com>2013-11-24 15:09:41 -0200
committerFelipe Pena <felipensp@gmail.com>2013-11-24 15:09:41 -0200
commit5b89e181aad451d67a7f3048049185b10d7c2efd (patch)
tree6479fdf58a60981898c269253ee0ef308b128443
parent8589c0af91b78c59c8a226ad7eec9af3262e8737 (diff)
downloadphp-git-5b89e181aad451d67a7f3048049185b10d7c2efd.tar.gz
- Added more colors
-rw-r--r--phpdbg_set.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/phpdbg_set.c b/phpdbg_set.c
index 650f2116c8..41abec103a 100644
--- a/phpdbg_set.c
+++ b/phpdbg_set.c
@@ -61,14 +61,22 @@ const char *phpdbg_get_prompt(TSRMLS_D) /* {{{ */
void phpdbg_set_prompt_color(const char *color TSRMLS_DC) /* {{{ */
{
- if (memcmp(color, PHPDBG_STRL("blue")) == 0) {
- PHPDBG_G(prompt_color) = estrndup("blue", sizeof("blue")-1);
- phpdbg_set_prompt(PHPDBG_G(prompt_raw), "0;34" TSRMLS_CC);
- } else if (memcmp(color, PHPDBG_STRL("green")) == 0) {
- PHPDBG_G(prompt_color) = estrndup("green", sizeof("green")-1);
- phpdbg_set_prompt(PHPDBG_G(prompt_raw), "0;32" TSRMLS_CC);
- }
-
+ static const char *colors[] = {
+ "blue", "0;34",
+ "green", "0;32",
+ "red", "0;31",
+ "cyan", "0;36",
+ "purple", "0;35",
+ NULL, NULL
+ };
+ const char **p = colors;
+
+ do {
+ if (memcmp(color, *p, strlen(*p)+1) == 0) {
+ PHPDBG_G(prompt_color) = estrdup(*p);
+ phpdbg_set_prompt(PHPDBG_G(prompt_raw), *(p+1) TSRMLS_CC);
+ }
+ } while (++p && *(++p));
} /* }}} */
const char* phpdbg_get_prompt_color(TSRMLS_D) /* {{{ */