if (input->argc > 0) {
while (command && command->name && command->handler) {
- if (((command->name_len == input->argv[0]->length) &&
+ if (((command->name_len == input->argv[0]->length) &&
(memcmp(command->name, input->argv[0]->string, command->name_len) == SUCCESS)) ||
(command->alias &&
- (input->argv[0]->length == 1) &&
+ (input->argv[0]->length == 1) &&
(command->alias == *input->argv[0]->string))) {
- if (command->subs && input->argc > 1) {
- phpdbg_input_t sub;
+
+ phpdbg_param_t param;
+
+ param.type = EMPTY_PARAM;
- sub.argc = input->argc-1;
- sub.argv = &input->argv[1];
+ if (input->argc > 1) {
+ if (command->subs) {
+ phpdbg_input_t sub;
- return phpdbg_do_cmd_ex(command->subs, &sub TSRMLS_CC);
+ sub.argc = input->argc-1;
+ sub.argv = &input->argv[1];
+
+ phpdbg_debug(
+ "trying sub commands in \"%s\" for \"%s\" with %d arguments",
+ command->name, sub.argv[0]->string, sub.argc-1);
+
+ return phpdbg_do_cmd_ex(command->subs, &sub TSRMLS_CC);
+ } else {
+ phpdbg_parse_param(
+ input->argv[1]->string,
+ input->argv[1]->length,
+ ¶m TSRMLS_CC);
- }
++ }
}
+
phpdbg_debug(
- "found command \"%s\" for \"%s\" have %d arguments",
+ "found command %s for %s with %d arguments",
command->name, input->argv[0]->string, input->argc-1);
-#ifdef PHPDBG_DEBUG
{
int arg;
for (arg=1; arg<input->argc; arg++) {
input->argv[arg]->length);
}
}
-#endif
+
+ PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
+ phpdbg_clear_param(
+ &PHPDBG_G(lparam) TSRMLS_CC);
+ PHPDBG_G(lparam) = param;
+
+ rc = command->handler(¶m TSRMLS_CC);
-
break;
}
command++;
int ret = SUCCESS;
phpdbg_input_t* input = phpdbg_read_input(TSRMLS_C);
-
+
if (input && input->length > 0L) {
do {
- phpdbg_do_cmd_ex(phpdbg_prompt_commands, input TSRMLS_CC);
-
- switch (ret = phpdbg_do_cmd(phpdbg_prompt_commands, input->string, input->length TSRMLS_CC)) {
+ switch (ret = phpdbg_do_cmd_ex(phpdbg_prompt_commands, input TSRMLS_CC)) {
case FAILURE:
if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
if (phpdbg_call_register(input TSRMLS_CC) == FAILURE) {