com php-src: fix argc/argv: phpdbg.c phpdbg_prompt.c
| From: | Bob Weinand | Date: | Sun, 13 Apr 2014 07:34:16 +0000 |
| Subject: | com php-src: fix argc/argv: phpdbg.c phpdbg_prompt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77008@lists.php.net to get a copy of this message | ||
Commit: 4387723ef779135dfdaf36f1a3f451ca4c564877
Author: krakjoe <joe.watkins@live.co.uk> Sun, 13 Apr 2014 08:34:16 +0100
Parents: 65984df220c494e431fa148f437115ca02cb7d39
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4387723ef779135dfdaf36f1a3f451ca4c564877
Log:
fix argc/argv
Changed paths:
M phpdbg.c
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index 37a938f..8903073 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -1120,12 +1120,13 @@ phpdbg_main:
if (phpdbg->startup(phpdbg) == SUCCESS) {
int i;
+
SG(request_info).argc = argc - php_optind + 1;
SG(request_info).argv = emalloc(SG(request_info).argc * sizeof(char *));
for (i = SG(request_info).argc; --i;) {
SG(request_info).argv[i] = estrdup(argv[php_optind - 1 + i]);
}
- SG(request_info).argv[php_optind - 1] = exec?exec:"";
+ SG(request_info).argv[i] = exec?exec:"";
php_request_startup(TSRMLS_C);
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 373260c..85f22ca 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -191,7 +191,9 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack TSRMLS_DC) /* {{{ *
void phpdbg_try_file_init(char *init_file, size_t init_file_len, zend_bool free_init TSRMLS_DC) /*
{{{ */
{
struct stat sb;
-
+
+ printf("try %s\n", init_file);
+
if (init_file && VCWD_STAT(init_file, &sb) != -1) {
FILE *fp = fopen(init_file, "r");
if (fp) {
@@ -304,7 +306,7 @@ next_line:
if (free_init) {
free(init_file);
}
- }
+ } else printf("failed to open %s\n", init_file);
} /* }}} */
void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default TSRMLS_DC) /* {{{ */
@@ -648,7 +650,8 @@ PHPDBG_COMMAND(run) /* {{{ */
char **argv = emalloc(5 * sizeof(char *));
int argc = 0;
int i;
- char *argv_str = strtok(input->string, " ");
+ char *argv_str = NULL;
+ printf("param->str: %s\n", param->str);
while (argv_str) {
if (argc >= 4 && argc == (argc & -argc)) {
argv = erealloc(argv, (argc * 2 + 1) * sizeof(char *));