From 996182993da1c35e8c35a3188b4c1adb764320f8 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Wed, 19 Feb 2014 08:33:54 +0000 Subject: [PATCH] remove input_t support single char aliases ... --- phpdbg.c | 10 ++-- phpdbg_bp.c | 2 +- phpdbg_bp.h | 2 +- phpdbg_break.c | 6 +-- phpdbg_cmd.c | 87 ++++++++++++++++++++++------------ phpdbg_cmd.h | 24 +++------- phpdbg_help.c | 2 +- phpdbg_prompt.c | 121 +++++++++++++++++++++++++++--------------------- phpdbg_set.c | 15 +++--- 9 files changed, 150 insertions(+), 119 deletions(-) diff --git a/phpdbg.c b/phpdbg.c index 7676687e71..0b748f0e85 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -271,19 +271,19 @@ static PHP_FUNCTION(phpdbg_break) switch (type) { case METHOD_PARAM: - phpdbg_do_break_method(¶m, NULL TSRMLS_CC); + phpdbg_do_break_method(¶m TSRMLS_CC); break; case FILE_PARAM: - phpdbg_do_break_file(¶m, NULL TSRMLS_CC); + phpdbg_do_break_file(¶m TSRMLS_CC); break; case NUMERIC_PARAM: - phpdbg_do_break_lineno(¶m, NULL TSRMLS_CC); + phpdbg_do_break_lineno(¶m TSRMLS_CC); break; case STR_PARAM: - phpdbg_do_break_func(¶m, NULL TSRMLS_CC); + phpdbg_do_break_func(¶m TSRMLS_CC); break; default: zend_error( @@ -1232,7 +1232,7 @@ phpdbg_main: if (run) { /* no need to try{}, run does it ... */ - PHPDBG_COMMAND_HANDLER(run)(NULL, NULL TSRMLS_CC); + PHPDBG_COMMAND_HANDLER(run)(NULL TSRMLS_CC); if (run > 1) { /* if -r is on the command line more than once just quit */ goto phpdbg_out; diff --git a/phpdbg_bp.c b/phpdbg_bp.c index acb53450cb..cacc48f13f 100644 --- a/phpdbg_bp.c +++ b/phpdbg_bp.c @@ -760,7 +760,7 @@ PHPDBG_API void phpdbg_set_breakpoint_expression(const char *expr, size_t expr_l } } /* }}} */ -PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param, const phpdbg_input_t *input TSRMLS_DC) /* {{{ */ +PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param TSRMLS_DC) /* {{{ */ { /* if (input->argc > 3 && phpdbg_argv_is(2, "if")) { diff --git a/phpdbg_bp.h b/phpdbg_bp.h index b1a9ddf474..97980e7ed7 100644 --- a/phpdbg_bp.h +++ b/phpdbg_bp.h @@ -119,7 +119,7 @@ PHPDBG_API void phpdbg_set_breakpoint_method_opline(const char *class, const cha PHPDBG_API void phpdbg_set_breakpoint_function_opline(const char *function, zend_ulong opline TSRMLS_DC); PHPDBG_API void phpdbg_set_breakpoint_file_opline(const char *file, zend_ulong opline TSRMLS_DC); PHPDBG_API void phpdbg_set_breakpoint_expression(const char* expression, size_t expression_len TSRMLS_DC); -PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param, const phpdbg_input_t *input TSRMLS_DC); /* }}} */ +PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param TSRMLS_DC); /* }}} */ /* {{{ Breakpoint Detection API */ PHPDBG_API phpdbg_breakbase_t* phpdbg_find_breakpoint(zend_execute_data* TSRMLS_DC); /* }}} */ diff --git a/phpdbg_break.c b/phpdbg_break.c index 870f68a481..aeaf5973f0 100644 --- a/phpdbg_break.c +++ b/phpdbg_break.c @@ -38,8 +38,8 @@ const phpdbg_command_t phpdbg_break_commands[] = { PHPDBG_COMMAND_D_EX(op, "specify breakpoint by opcode", 'O', break_op, NULL, "s"), PHPDBG_COMMAND_D_EX(on, "specify breakpoint by condition", 'o', break_on, NULL, "c"), PHPDBG_COMMAND_D_EX(at, "specify breakpoint by location and condition", 'A', break_at, NULL, "*c"), - PHPDBG_COMMAND_D_EX(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, "l"), - PHPDBG_COMMAND_D_EX(del, "delete breakpoint by identifier number", 'd', break_del, NULL, "l"), + PHPDBG_COMMAND_D_EX(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, "n"), + PHPDBG_COMMAND_D_EX(del, "delete breakpoint by identifier number", 'd', break_del, NULL, "n"), PHPDBG_END_COMMAND }; @@ -109,7 +109,7 @@ PHPDBG_BREAK(on) /* {{{ */ PHPDBG_BREAK(at) /* {{{ */ { - phpdbg_set_breakpoint_at(param, input TSRMLS_CC); + phpdbg_set_breakpoint_at(param TSRMLS_CC); return SUCCESS; } /* }}} */ diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c index c0149b3ad2..b678d393ab 100644 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@ -253,6 +253,10 @@ PHPDBG_API void phpdbg_copy_param(const phpdbg_param_t* src, phpdbg_param_t* des break; case EMPTY_PARAM: { /* do nothing */ } break; + + default: { + /* not yet */ + } } } /* }}} */ @@ -302,6 +306,10 @@ PHPDBG_API zend_ulong phpdbg_hash_param(const phpdbg_param_t *param TSRMLS_DC) / break; case EMPTY_PARAM: { /* do nothing */ } break; + + default: { + /* not yet */ + } } return hash; @@ -371,6 +379,10 @@ PHPDBG_API zend_bool phpdbg_match_param(const phpdbg_param_t *l, const phpdbg_pa case EMPTY_PARAM: return 1; + + default: { + /* not yet */ + } } } } @@ -382,7 +394,7 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg) if (param && param->type) { switch (param->type) { case STR_PARAM: - fprintf(stderr, "%s STR_PARAM(%s=%d)\n", msg, param->str, param->len); + fprintf(stderr, "%s STR_PARAM(%s=%lu)\n", msg, param->str, param->len); break; case ADDR_PARAM: @@ -390,7 +402,7 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg) break; case FILE_PARAM: - fprintf(stderr, "%s FILE_PARAM(%s:%d)\n", msg, param->file.name, param->file.line); + fprintf(stderr, "%s FILE_PARAM(%s:%lu)\n", msg, param->file.name, param->file.line); break; case METHOD_PARAM: @@ -402,7 +414,7 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg) break; case NUMERIC_FUNCTION_PARAM: - fprintf(stderr, "%s NUMERIC_FUNCTION_PARAM(%s::%s)\n", msg, param->str, param->num); + fprintf(stderr, "%s NUMERIC_FUNCTION_PARAM(%s::%ld)\n", msg, param->str, param->num); break; case NUMERIC_PARAM: @@ -410,8 +422,12 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg) break; case COND_PARAM: - fprintf(stderr, "%s COND_PARAM(%s=%d)\n", msg, param->str, param->len); + fprintf(stderr, "%s COND_PARAM(%s=%lu)\n", msg, param->str, param->len); break; + + default: { + /* not yet */ + } } } } /* }}} */ @@ -439,6 +455,10 @@ PHPDBG_API void phpdbg_stack_free(phpdbg_param_t *stack) { free(remove->file.name); } break; + + default: { + /* nothing */ + } } free(remove); @@ -471,7 +491,7 @@ PHPDBG_API void phpdbg_stack_push(phpdbg_param_t *stack, phpdbg_param_t *param) stack->len++; } /* }}} */ -PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param_t **stack, char **why TSRMLS_DC) { +PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param_t **stack, char **why TSRMLS_DC) { if (command && command->args) { const phpdbg_param_t *top = (stack != NULL) ? *stack : NULL; const char *arg = command->args; @@ -502,7 +522,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param case 'i': if (top->type != STR_PARAM) { asprintf(why, - "%s expected raw input and got %s at parameter %d", + "%s expected raw input and got %s at parameter %lu", command->name, phpdbg_get_param_type(top TSRMLS_CC), (command->args - arg) + 1); return FAILURE; @@ -510,7 +530,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param case 's': if (top->type != STR_PARAM) { asprintf(why, - "%s expected string and got %s at parameter %d", + "%s expected string and got %s at parameter %lu", command->name, phpdbg_get_param_type(top TSRMLS_CC), (command->args - arg) + 1); return FAILURE; @@ -518,7 +538,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param case 'n': if (top->type != NUMERIC_PARAM) { asprintf(why, - "%s expected number and got %s at parameter %d", + "%s expected number and got %s at parameter %lu", command->name, phpdbg_get_param_type(top TSRMLS_CC), (command->args - arg) + 1); return FAILURE; @@ -526,7 +546,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param case 'm': if (top->type != METHOD_PARAM) { asprintf(why, - "%s expected method and got %s at parameter %d", + "%s expected method and got %s at parameter %lu", command->name, phpdbg_get_param_type(top TSRMLS_CC), (command->args - arg) + 1); return FAILURE; @@ -534,7 +554,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param case 'a': if (top->type != ADDR_PARAM) { asprintf(why, - "%s expected address and got %s at parameter %d", + "%s expected address and got %s at parameter %lu", command->name, phpdbg_get_param_type(top TSRMLS_CC), (command->args - arg) + 1); return FAILURE; @@ -542,7 +562,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param case 'f': if (top->type != FILE_PARAM) { asprintf(why, - "%s expected file:line and got %s at parameter %d", + "%s expected file:line and got %s at parameter %lu", command->name, phpdbg_get_param_type(top TSRMLS_CC), (command->args - arg) + 1); return FAILURE; @@ -550,7 +570,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param case 'c': if (top->type != COND_PARAM) { asprintf(why, - "%s expected condition and got %s at parameter %d", + "%s expected condition and got %s at parameter %lu", command->name, phpdbg_get_param_type(top TSRMLS_CC), (command->args - arg) + 1); return FAILURE; @@ -558,14 +578,14 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param case 'b': if (top->type != NUMERIC_PARAM) { asprintf(why, - "%s expected boolean and got %s at parameter %d", + "%s expected boolean and got %s at parameter %lu", command->name, phpdbg_get_param_type(top TSRMLS_CC), (command->args - arg) + 1); return FAILURE; } else if (top->num > 1 || top->num < 0) { asprintf(why, - "%s expected boolean and got number at parameter %d", - command->name, phpdbg_get_param_type(top TSRMLS_CC), + "%s expected boolean and got number at parameter %lu", + command->name, (command->args - arg) + 1); return FAILURE; } break; @@ -579,7 +599,7 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param if ((received < expected) && (arg && *arg) && !optional) { asprintf(why, - "%s expected %d arguments (%s) and received %d", + "%s expected %lu arguments (%s) and received %lu", command->name, expected, command->args, @@ -592,20 +612,28 @@ PHPDBG_API int phpdbg_stack_verify(phpdbg_command_t *command, const phpdbg_param } /* {{{ */ -PHPDBG_API phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *commands, const phpdbg_command_t *parent, phpdbg_param_t **top, char **why) { +PHPDBG_API const phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *commands, const phpdbg_command_t *parent, phpdbg_param_t **top, char **why) { const phpdbg_command_t *command = commands; phpdbg_param_t *name = *top; - phpdbg_command_t *matched[3] = {NULL, NULL, NULL}; - + const phpdbg_command_t *matched[3] = {NULL, NULL, NULL}; ulong matches = 0L; while (command && command->name && command->handler) { - if (command->name_len >= name->len) { - if (memcmp(command->name, name->str, name->len) == SUCCESS) { - if (matches < 3) { + if ((name->len == 1) || (command->name_len >= name->len)) { + /* match single letter alias */ + if (command->alias && (name->len == 1)) { + if (command->alias == (*name->str)) { matched[matches] = command; matches++; - } else break; + } + } else { + /* match full command name */ + if (memcmp(command->name, name->str, name->len) == SUCCESS) { + if (matches < 3) { + matched[matches] = command; + matches++; + } else break; + } } } command++; @@ -629,7 +657,7 @@ PHPDBG_API phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *comman default: { asprintf( why, - "The command %s is ambigious, matching %d commands", + "The command %s is ambigious, matching %lu commands", name->str, matches); } return NULL; } @@ -645,9 +673,8 @@ PHPDBG_API phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *comman /* {{{ */ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) { - phpdbg_param_t *command = NULL, - *params = NULL; - phpdbg_command_t *handler = NULL; + phpdbg_param_t *command = NULL; + const phpdbg_command_t *handler = NULL; if (stack->type != STACK_PARAM) { asprintf( @@ -665,10 +692,10 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) { switch (command->type) { case EVAL_PARAM: - return PHPDBG_COMMAND_HANDLER(eval)(command, NULL TSRMLS_CC); + return PHPDBG_COMMAND_HANDLER(eval)(command TSRMLS_CC); case SHELL_PARAM: - return PHPDBG_COMMAND_HANDLER(shell)(command, NULL TSRMLS_CC); + return PHPDBG_COMMAND_HANDLER(shell)(command TSRMLS_CC); case STR_PARAM: { handler = phpdbg_stack_resolve( @@ -676,7 +703,7 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, char **why) { if (handler) { if (phpdbg_stack_verify(handler, &command, why) == SUCCESS) { - return handler->handler(command, NULL TSRMLS_CC); + return handler->handler(command TSRMLS_CC); } } } return FAILURE; diff --git a/phpdbg_cmd.h b/phpdbg_cmd.h index 23766c62da..da2a25cbbd 100644 --- a/phpdbg_cmd.h +++ b/phpdbg_cmd.h @@ -23,8 +23,6 @@ #include "TSRM.h" -typedef struct _phpdbg_command_t phpdbg_command_t; - /* {{{ Command and Parameter */ enum { NO_ARG = 0, @@ -48,16 +46,6 @@ typedef enum { ORIG_PARAM } phpdbg_param_type; -typedef struct _phpdbg_input_t phpdbg_input_t; - -struct _phpdbg_input_t { - char * const *start; - char *string; - size_t length; - phpdbg_input_t **argv; - int argc; -}; - typedef struct _phpdbg_param phpdbg_param_t; struct _phpdbg_param { phpdbg_param_type type; @@ -95,8 +83,9 @@ struct _phpdbg_param { #define YYSTYPE phpdbg_param_t #endif -typedef int (*phpdbg_command_handler_t)(const phpdbg_param_t*, const phpdbg_input_t* TSRMLS_DC); +typedef int (*phpdbg_command_handler_t)(const phpdbg_param_t* TSRMLS_DC); +typedef struct _phpdbg_command_t phpdbg_command_t; struct _phpdbg_command_t { const char *name; /* Command name */ size_t name_len; /* Command name length */ @@ -147,7 +136,8 @@ PHPDBG_API void phpdbg_destroy_input(char** TSRMLS_DC); * Stack Management */ PHPDBG_API void phpdbg_stack_push(phpdbg_param_t *stack, phpdbg_param_t *param); -PHPDBG_API phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *commands, const phpdbg_command_t *parent, phpdbg_param_t **top, char **why); +PHPDBG_API const phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t *commands, const phpdbg_command_t *parent, phpdbg_param_t **top, char **why); +PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param_t **stack, char **why TSRMLS_DC); PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack, char **why); PHPDBG_API void phpdbg_stack_free(phpdbg_param_t *stack); @@ -174,11 +164,11 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg) #define PHPDBG_COMMAND_D(name, tip, alias, children, args) \ {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, phpdbg_do_##name, children, args} -#define PHPDBG_COMMAND(name) int phpdbg_do_##name(const phpdbg_param_t *param, const phpdbg_input_t *input TSRMLS_DC) +#define PHPDBG_COMMAND(name) int phpdbg_do_##name(const phpdbg_param_t *param TSRMLS_DC) -#define PHPDBG_COMMAND_ARGS param, input TSRMLS_CC +#define PHPDBG_COMMAND_ARGS param TSRMLS_CC -#define PHPDBG_END_COMMAND {NULL, 0, NULL, 0, '\0', NULL, NULL, '\0', '\0'} +#define PHPDBG_END_COMMAND {NULL, 0, NULL, 0, '\0', NULL, NULL, '\0'} /* * Default Switch Case diff --git a/phpdbg_help.c b/phpdbg_help.c index 8dcc89007d..d3404f5569 100644 --- a/phpdbg_help.c +++ b/phpdbg_help.c @@ -240,7 +240,7 @@ PHPDBG_COMMAND(help) /* {{{ */ if (n>0) { if (cmd->alias == 'a') { /* help aliases executes a canned routine */ - return cmd->handler(param, NULL TSRMLS_CC); + return cmd->handler(param TSRMLS_CC); } else { pretty_print(get_help(cmd->name TSRMLS_CC) TSRMLS_CC); return SUCCESS; diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 1e1f048ebf..aed1f4a015 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -73,66 +73,81 @@ const phpdbg_command_t phpdbg_prompt_commands[] = { ZEND_EXTERN_MODULE_GLOBALS(phpdbg); -static inline int phpdbg_call_register(phpdbg_input_t *input TSRMLS_DC) /* {{{ */ +static inline int phpdbg_call_register(phpdbg_param_t *stack TSRMLS_DC) /* {{{ */ { - phpdbg_input_t *function = input->argv[0]; - - if (zend_hash_exists( - &PHPDBG_G(registered), function->string, function->length+1)) { - - zval fname, *fretval; - zend_fcall_info fci; - - ZVAL_STRINGL(&fname, function->string, function->length, 1); - - memset(&fci, 0, sizeof(zend_fcall_info)); - - fci.size = sizeof(zend_fcall_info); - fci.function_table = &PHPDBG_G(registered); - fci.function_name = &fname; - fci.symbol_table = EG(active_symbol_table); - fci.object_ptr = NULL; - fci.retval_ptr_ptr = &fretval; - fci.no_separation = 1; - - if (input->argc > 1) { - int param; - zval params; - - array_init(¶ms); - - for (param = 0; param < (input->argc-1); param++) { - add_next_index_stringl( - ¶ms, - input->argv[param+1]->string, - input->argv[param+1]->length, 1); + phpdbg_param_t *name = stack; + + if (name->type == STR_PARAM) { + if (zend_hash_exists( + &PHPDBG_G(registered), name->str, name->len+1)) { + + zval fname, *fretval; + zend_fcall_info fci; + + ZVAL_STRINGL(&fname, name->str, name->len, 1); + + memset(&fci, 0, sizeof(zend_fcall_info)); + + fci.size = sizeof(zend_fcall_info); + fci.function_table = &PHPDBG_G(registered); + fci.function_name = &fname; + fci.symbol_table = EG(active_symbol_table); + fci.object_ptr = NULL; + fci.retval_ptr_ptr = &fretval; + fci.no_separation = 1; + + if (stack->next) { + zval params; + phpdbg_param_t *next = stack->next; + + array_init(¶ms); + + while (next) { + switch (next->type) { + case STR_PARAM: + add_next_index_stringl( + ¶ms, + next->str, + next->len, 1); + break; + + case NUMERIC_PARAM: + add_next_index_long(¶ms, next->num); + break; + + default: { + /* not yet */ + } + } + + phpdbg_debug( + "created param[%d] from argv[%d]: %s", + param, param+1, next->str); + next = next->next; + } - phpdbg_debug( - "created param[%d] from argv[%d]: %s", - param, param+1, input->argv[param+1]->string); + zend_fcall_info_args(&fci, ¶ms TSRMLS_CC); + } else { + fci.params = NULL; + fci.param_count = 0; } - zend_fcall_info_args(&fci, ¶ms TSRMLS_CC); - } else { - fci.params = NULL; - fci.param_count = 0; - } - - phpdbg_debug( - "created %d params from %d arguments", - fci.param_count, input->argc); + phpdbg_debug( + "created %d params from arguments", + fci.param_count); - zend_call_function(&fci, NULL TSRMLS_CC); + zend_call_function(&fci, NULL TSRMLS_CC); - if (fretval) { - zend_print_zval_r( - fretval, 0 TSRMLS_CC); - phpdbg_writeln(EMPTY); - } + if (fretval) { + zend_print_zval_r( + fretval, 0 TSRMLS_CC); + phpdbg_writeln(EMPTY); + } - zval_dtor(&fname); + zval_dtor(&fname); - return SUCCESS; + return SUCCESS; + } } return FAILURE; @@ -1027,7 +1042,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ last: if (PHPDBG_G(lcmd)) { ret = PHPDBG_G(lcmd)->handler( - &PHPDBG_G(lparam), input TSRMLS_CC); + &PHPDBG_G(lparam) TSRMLS_CC); goto out; } } diff --git a/phpdbg_set.c b/phpdbg_set.c index a0dac2ea5b..7ce67d934d 100644 --- a/phpdbg_set.c +++ b/phpdbg_set.c @@ -69,7 +69,7 @@ PHPDBG_SET(break) /* {{{ */ break; case NUMERIC_PARAM: { - if (input && input->argc > 2) { + if (param->next) { /* if (phpdbg_argv_is(2, "on")) { phpdbg_enable_breakpoint(param->num TSRMLS_CC); @@ -99,14 +99,13 @@ PHPDBG_SET(break) /* {{{ */ #ifndef _WIN32 PHPDBG_SET(color) /* {{{ */ { - if ((param->type == STR_PARAM) && (input->argc == 3)) { + /*if ((param->type == STR_PARAM) && (input->argc == 3)) { const phpdbg_color_t *color = phpdbg_get_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")) { + if (phpdbg_argv_is(1, "prompt")) { phpdbg_notice( "setting prompt color to %s (%s)", color->name, color->code); element = PHPDBG_COLOR_PROMPT; @@ -125,9 +124,8 @@ PHPDBG_SET(color) /* {{{ */ element = PHPDBG_COLOR_NOTICE; } else goto usage; -*/ - /* set color for element */ - /* phpdbg_set_color(element, color TSRMLS_CC); */ + + phpdbg_set_color(element, color TSRMLS_CC); } else { phpdbg_error( "Failed to find the requested color (%s)", input->argv[2]->string); @@ -136,7 +134,8 @@ PHPDBG_SET(color) /* {{{ */ usage: phpdbg_error( "set color used incorrectly: set color "); - } + } */ + return SUCCESS; } /* }}} */ -- 2.50.1