From: krakjoe Date: Thu, 14 Nov 2013 14:14:13 +0000 (+0000) Subject: phpdbg_init from file & command line option (no impl yet) X-Git-Tag: php-5.6.0alpha1~110^2~336 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7763b0b3830f761334535f3da7321e10e22f1c18;p=php phpdbg_init from file & command line option (no impl yet) --- diff --git a/phpdbg.c b/phpdbg.c index 4accf2fa4a..207e4ca0ed 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -296,6 +296,7 @@ const opt_struct OPTIONS[] = { /* {{{ */ {'v', 0, "verbose"}, {'s', 0, "step"}, {'b', 0, "boring colours"}, + {'i', 1, "init"}, {'-', 0, NULL} }; /* }}} */ @@ -321,8 +322,6 @@ void phpdbg_ini_defaults(HashTable *configuration_hash) /* {{{ */ INI_DEFAULT("display_errors", "1"); } /* }}} */ -static jmp_buf phpdbg_main; - int main(int argc, char **argv) /* {{{ */ { sapi_module_struct *phpdbg = &phpdbg_sapi_module; @@ -330,6 +329,8 @@ int main(int argc, char **argv) /* {{{ */ int ini_entries_len; char *exec; size_t exec_len; + char *init_file; + size_t init_file_len; zend_ulong flags; char *php_optarg; int php_optind; @@ -358,6 +359,8 @@ phpdbg_main: ini_entries_len = 0; exec = NULL; exec_len = 0; + init_file = NULL; + init_file_len = 0; flags = PHPDBG_DEFAULT_FLAGS; php_optarg = NULL; php_optind = 1; @@ -413,6 +416,13 @@ phpdbg_main: exec = strdup(php_optarg); } break; + + case 'i': /* set init file */ + init_file_len = strlen(php_optarg); + if (init_file_len) { + init_file = strdup(php_optarg); + } + break; case 'v': /* set quietness off */ flags &= ~PHPDBG_IS_QUIET; @@ -476,6 +486,9 @@ phpdbg_main: zend_activate_modules(TSRMLS_C); } zend_end_try(); + /* initialize from file */ + phpdbg_init(init_file, init_file_len TSRMLS_CC); + /* print blurb */ phpdbg_welcome(cleaning TSRMLS_CC); diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 91e9990583..7d20580922 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -71,6 +71,14 @@ static const phpdbg_command_t phpdbg_prompt_commands[] = { ZEND_EXTERN_MODULE_GLOBALS(phpdbg); +void phpdbg_init(char *init_file, size_t init_file_len TSRMLS_DC) /* {{{ */ +{ + if (init_file) { + + free(init_file); + } +} /* }}} */ + void phpdbg_welcome(zend_bool cleaning TSRMLS_DC) /* {{{ */ { /* print blurb */ diff --git a/phpdbg_prompt.h b/phpdbg_prompt.h index b7d710109e..2ffe672c80 100644 --- a/phpdbg_prompt.h +++ b/phpdbg_prompt.h @@ -61,6 +61,7 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le #define PHPDBG_COMMAND(name) \ int phpdbg_do_##name(const char *expr, size_t expr_len TSRMLS_DC) +void phpdbg_init(char *init_file, size_t init_file_len TSRMLS_DC); void phpdbg_welcome(zend_bool cleaning TSRMLS_DC); int phpdbg_interactive(TSRMLS_D); void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC);