com php-src: more command line options: phpdbg.c phpdbg_promp t.c
| From: | Bob Weinand | Date: | Tue, 12 Nov 2013 04:53:04 +0000 |
| Subject: | com php-src: more command line options: phpdbg.c phpdbg_promp t.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75088@lists.php.net to get a copy of this message | ||
Commit: 6c317b771e5e342497a39e5610c8fe49cfd628a0
Author: krakjoe <joe.watkins@live.co.uk> Tue, 12 Nov 2013 04:53:04 +0000
Parents: bf8a9c141fcad21738156349a9c2b2900ee2908a
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6c317b771e5e342497a39e5610c8fe49cfd628a0
Log:
more command line options
Changed paths:
M phpdbg.c
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index ca38078..52998a6 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -262,6 +262,10 @@ const opt_struct OPTIONS[] = { /* {{{ */
{'d', 1, "define ini entry on command line"},
{'n', 0, "no php.ini"},
{'z', 1, "load zend_extension"},
+ /* phpdbg options */
+ {'e', 1, "exec"},
+ {'v', 0, "verbose"},
+ {'s', 0, "step"},
{'-', 0, NULL}
}; /* }}} */
@@ -291,6 +295,9 @@ int main(int argc, char *argv[]) /* {{{ */
sapi_module_struct *phpdbg = &phpdbg_sapi_module;
char *ini_entries = NULL;
int ini_entries_len = 0;
+ char *exec = NULL;
+ size_t exec_len = 0L;
+ zend_ulong flags = PHPDBG_IS_QUIET;
char *php_optarg = NULL;
int php_optind = 1;
int opt;
@@ -311,7 +318,7 @@ int main(int argc, char *argv[]) /* {{{ */
tsrm_ls = ts_resource(0);
#endif
-
+
while ((opt = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2)) != -1) {
switch (opt) {
case 'n':
@@ -355,6 +362,21 @@ int main(int argc, char *argv[]) /* {{{ */
case 'z':
zend_load_extension(php_optarg);
break;
+
+ case 'e': /* set execution context */
+ exec_len = strlen(php_optarg);
+ if (exec_len) {
+ exec = strdup(php_optarg);
+ }
+ break;
+
+ case 'v': /* set quietness off */
+ flags &= ~PHPDBG_IS_QUIET;
+ break;
+
+ case 's': /* set stepping on */
+ flags |= PHPDBG_IS_STEPPING;
+ break;
}
}
@@ -395,6 +417,16 @@ int main(int argc, char *argv[]) /* {{{ */
PG(modules_activated) = 0;
+ if (exec) { /* set execution context */
+ PHPDBG_G(exec) = estrndup(exec, exec_len);
+ PHPDBG_G(exec_len) = exec_len;
+
+ free(exec);
+ }
+
+ /* set flags from command line */
+ PHPDBG_G(flags) = flags;
+
zend_try {
zend_activate_modules(TSRMLS_C);
} zend_end_try();
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index e438072..d255a9d 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -604,7 +604,7 @@ phpdbg_interactive_enter:
#ifdef HAVE_LIBREADLINE
add_history(cmd);
#endif
-
+
switch (phpdbg_do_cmd(phpdbg_prompt_commands, cmd, cmd_len TSRMLS_CC)) {
case FAILURE:
if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {