com php-src: phpdbg_init from file & command line option (no impl yet): phpdbg.c phpdbg_pr ompt.c phpdbg_prompt.h
| From: | Bob Weinand | Date: | Thu, 14 Nov 2013 14:14:13 +0000 |
| Subject: | com php-src: phpdbg_init from file & command line option (no impl yet): phpdbg.c phpdbg_pr ompt.c phpdbg_prompt.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74976@lists.php.net to get a copy of this message | ||
Commit: 7763b0b3830f761334535f3da7321e10e22f1c18
Author: krakjoe <joe.watkins@live.co.uk> Thu, 14 Nov 2013 14:14:13 +0000
Parents: 1107ccef99540dab8f6d69a402b9288db0474889
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7763b0b3830f761334535f3da7321e10e22f1c18
Log:
phpdbg_init from file & command line option (no impl yet)
Changed paths:
M phpdbg.c
M phpdbg_prompt.c
M phpdbg_prompt.h
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index 4accf2f..207e4ca 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 91e9990..7d20580 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 b7d7101..2ffe672 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);