mirror of
https://github.com/php/php-src.git
synced 2026-03-31 04:32:19 +02:00
fix argc/argv
This commit is contained in:
3
phpdbg.c
3
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);
|
||||
|
||||
|
||||
@@ -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 *));
|
||||
|
||||
Reference in New Issue
Block a user