]> granicus.if.org Git - php/commitdiff
make it possible to show specific help pages without interactive session
authorJoe Watkins <krakjoe@php.net>
Sun, 20 Nov 2016 05:24:14 +0000 (05:24 +0000)
committerJoe Watkins <krakjoe@php.net>
Sun, 20 Nov 2016 05:25:42 +0000 (05:25 +0000)
sapi/phpdbg/phpdbg.c
sapi/phpdbg/phpdbg_help.c
sapi/phpdbg/phpdbg_help.h

index f570763ca07ba2a90b2447f77f3dd211a2bb8c70..2adca8e2c8b7525e2c48f915245b7bbdbe93a9c9 100644 (file)
@@ -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",
index 0943a7ea2cbce5bb5b6029ac3d2aee61e165c0a6..eb62d76d2e77c11856c0de2138c394045af3642a 100644 (file)
@@ -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;
index 7473684d3fe16bf78ec4d3173e3989a228401501..d44eca15ee81c8e062fe541d2f55338a1acf6f3d 100644 (file)
@@ -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 */