com php-src: fix shell command to use new input: phpdbg_promp t.c
| From: | Bob Weinand | Date: | Wed, 20 Nov 2013 13:43:58 +0000 |
| Subject: | com php-src: fix shell command to use new input: phpdbg_promp t.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74770@lists.php.net to get a copy of this message | ||
Commit: d5388bac793994d6eb264c8973f16516c0a0ab8e
Author: krakjoe <joe.watkins@live.co.uk> Wed, 20 Nov 2013 13:43:58 +0000
Parents: de3b59415643ffb3460f16f786f67647627d5916
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d5388bac793994d6eb264c8973f16516c0a0ab8e
Log:
fix shell command to use new input
Changed paths:
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 7eeefa1..2c931a4 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -663,13 +663,29 @@ static PHPDBG_COMMAND(shell) /* {{{ */
/* don't allow this to loop, ever ... */
switch (param->type) {
case STR_PARAM: {
- FILE *fd = VCWD_POPEN(param->str, "w");
- if (fd) {
+ FILE *fd = NULL;
+ char * program = NULL;
+
+ /* we expect an input, I hope we get one ! */
+ if (input && input->start) {
+ program = (char*) input->start;
+
+ if (memcmp(
+ program, "shell", sizeof("shell")-1) == SUCCESS) {
+ program += sizeof("shell")-1;
+ } else program += sizeof("-")-1;
+
+ while (program && isspace(*program)) {
+ program++;
+ }
+ } else program = param->str;
+
+ if ((fd=VCWD_POPEN((char*)program, "w"))) {
/* do something perhaps ?? do we want input ?? */
fclose(fd);
} else {
phpdbg_error(
- "Failed to execute %s", param->str);
+ "Failed to execute %s", program);
}
} break;