com php-src: added ability to override sapi name: Changelog.md phpdbg.c phpdbg_help.c
| From: | Bob Weinand | Date: | Mon, 02 Dec 2013 14:45:41 +0000 |
| Subject: | com php-src: added ability to override sapi name: Changelog.md phpdbg.c phpdbg_help.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75323@lists.php.net to get a copy of this message | ||
Commit: 6e7c1ed0c8ad19cd76491943b6276b209d39dddc
Author: krakjoe <joe.watkins@live.co.uk> Mon, 2 Dec 2013 14:45:41 +0000
Parents: 9b4e855d72a4624baa01c4c608f3a02171cab933
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6e7c1ed0c8ad19cd76491943b6276b209d39dddc
Log:
added ability to override sapi name
Changed paths:
M Changelog.md
M phpdbg.c
M phpdbg_help.c
Diff:
diff --git a/Changelog.md b/Changelog.md
index 8e817ca..aed299c 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -5,6 +5,7 @@ Version 0.3.0 2013-00-00
------------------------
1. Added ability to disable an enable a single breakpoint
+2. Added ability to override SAPI name
Version 0.2.0 2013-11-31
------------------------
diff --git a/phpdbg.c b/phpdbg.c
index 602cc0b..bbe992c 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -487,6 +487,7 @@ const opt_struct OPTIONS[] = { /* {{{ */
{'O', 1, "opline log"},
{'r', 0, "run"},
{'E', 0, "step-through-eval"},
+ {'S', 1, "sapi-name"},
#ifndef _WIN32
{'l', 1, "listen"},
{'a', 1, "address-or-any"},
@@ -716,6 +717,7 @@ int main(int argc, char **argv) /* {{{ */
zend_bool remote = 0;
int run = 0;
int step = 0;
+ char *sapi_name;
char *bp_tmp_file;
#ifndef _WIN32
char *address;
@@ -779,6 +781,7 @@ phpdbg_main:
opt = 0;
run = 0;
step = 0;
+ sapi_name = NULL;
while ((opt = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2)) != -1) {
switch (opt) {
@@ -832,9 +835,19 @@ phpdbg_main:
case 'e': { /* set execution context */
exec_len = strlen(php_optarg);
if (exec_len) {
+ if (exec) {
+ free(exec);
+ }
exec = strdup(php_optarg);
}
} break;
+
+ case 'S': { /* set SAPI name */
+ if (sapi_name) {
+ free(sapi_name);
+ }
+ sapi_name = strdup(php_optarg);
+ } break;
case 'I': { /* ignore .phpdbginit */
init_file_default = 0;
@@ -913,6 +926,10 @@ phpdbg_main:
}
#endif
+ if (sapi_name) {
+ phpdbg->name = sapi_name;
+ }
+
phpdbg->ini_defaults = phpdbg_ini_defaults;
phpdbg->phpinfo_as_text = 1;
phpdbg->php_ini_ignore_cwd = 1;
@@ -1142,6 +1159,10 @@ phpdbg_out:
free(address);
}
#endif
+
+ if (sapi_name) {
+ free(sapi_name);
+ }
free(bp_tmp_file);
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 6ae77fd..964f762 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -564,6 +564,7 @@ PHPDBG_HELP(options) /* {{{ */
phpdbg_writeln(" -O\t-Omy.oplog\t\tSets oplog output file");
phpdbg_writeln(" -r\tN/A\t\t\tRun execution context");
phpdbg_writeln(" -E\tN/A\t\t\tEnable step through eval, careful !");
+ phpdbg_writeln(" -S\t-Scli\t\t\tOverride SAPI name, careful !");
#ifndef _WIN32
phpdbg_writeln(" -l\t-l4000\t\t\tSetup remote console ports");
phpdbg_writeln(" -a\t-a192.168.0.3\t\tSetup remote console bind address");