summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Watkins <krakjoe@php.net>2016-11-20 05:24:14 +0000
committerJoe Watkins <krakjoe@php.net>2016-11-20 05:26:46 +0000
commit893a27d6327e29f0af4f8de7dc4c9569dd4a3698 (patch)
treedc30e6c4f186184398d96f1a315d0c5d665b6241
parent8113daef499d7d56cb9b5877b27c26667469615a (diff)
downloadphp-git-893a27d6327e29f0af4f8de7dc4c9569dd4a3698.tar.gz
make it possible to show specific help pages without interactive session
-rw-r--r--sapi/phpdbg/phpdbg.c2
-rw-r--r--sapi/phpdbg/phpdbg_help.c20
-rw-r--r--sapi/phpdbg/phpdbg_help.h2
3 files changed, 23 insertions, 1 deletions
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 6038348588..a1aeef70d2 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -1695,7 +1695,7 @@ phpdbg_main:
PHPDBG_G(io)[PHPDBG_STDOUT].ptr = stdout;
PHPDBG_G(io)[PHPDBG_STDOUT].fd = fileno(stdout);
if (show_help) {
- phpdbg_do_help(NULL);
+ phpdbg_do_help_cmd(exec);
} else if (show_version) {
phpdbg_out(
"phpdbg %s (built: %s %s)\nPHP %s, Copyright (c) 1997-2016 The PHP Group\n%s",
diff --git a/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c
index 0943a7ea2c..eb62d76d2e 100644
--- a/sapi/phpdbg/phpdbg_help.c
+++ b/sapi/phpdbg/phpdbg_help.c
@@ -209,6 +209,26 @@ static int get_command(
} /* }}} */
+void phpdbg_do_help_cmd(char *type) { /* {{{ */
+ char *help;
+
+ if (!type) {
+ pretty_print(get_help("overview!"));
+ return;
+ }
+
+ help = get_help(type);
+
+ if (!help || memcmp(help, "", sizeof("")) == SUCCESS) {
+ pretty_print(get_help("overview!"));
+ pretty_print(
+ "\nrequested help page could not be found");
+ return;
+ }
+
+ pretty_print(help);
+} /* }}} */
+
PHPDBG_COMMAND(help) /* {{{ */
{
phpdbg_command_t const *cmd;
diff --git a/sapi/phpdbg/phpdbg_help.h b/sapi/phpdbg/phpdbg_help.h
index 7473684d3f..d44eca15ee 100644
--- a/sapi/phpdbg/phpdbg_help.h
+++ b/sapi/phpdbg/phpdbg_help.h
@@ -45,4 +45,6 @@ typedef struct _phpdbg_help_text_t {
} phpdbg_help_text_t;
extern phpdbg_help_text_t phpdbg_help_text[];
+
+extern void phpdbg_do_help_cmd(char *type);
#endif /* PHPDBG_HELP_H */