Skip to content

Commit 7753d10

Browse files
committed
make it possible to show specific help pages without interactive session
1 parent 4819101 commit 7753d10

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

sapi/phpdbg/phpdbg.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1658,7 +1658,7 @@ int main(int argc, char **argv) /* {{{ */
16581658
PHPDBG_G(io)[PHPDBG_STDOUT].ptr = stdout;
16591659
PHPDBG_G(io)[PHPDBG_STDOUT].fd = fileno(stdout);
16601660
if (show_help) {
1661-
phpdbg_do_help(NULL);
1661+
phpdbg_do_help_cmd(exec);
16621662
} else if (show_version) {
16631663
phpdbg_out(
16641664
"phpdbg %s (built: %s %s)\nPHP %s, Copyright (c) 1997-2016 The PHP Group\n%s",

sapi/phpdbg/phpdbg_help.c

+20
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,26 @@ static int get_command(
209209

210210
} /* }}} */
211211

212+
void phpdbg_do_help_cmd(char *type) { /* {{{ */
213+
char *help;
214+
215+
if (!type) {
216+
pretty_print(get_help("overview!"));
217+
return;
218+
}
219+
220+
help = get_help(type);
221+
222+
if (!help || memcmp(help, "", sizeof("")) == SUCCESS) {
223+
pretty_print(get_help("overview!"));
224+
pretty_print(
225+
"\nrequested help page could not be found");
226+
return;
227+
}
228+
229+
pretty_print(help);
230+
} /* }}} */
231+
212232
PHPDBG_COMMAND(help) /* {{{ */
213233
{
214234
phpdbg_command_t const *cmd;

sapi/phpdbg/phpdbg_help.h

+2
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ typedef struct _phpdbg_help_text_t {
4545
} phpdbg_help_text_t;
4646

4747
extern phpdbg_help_text_t phpdbg_help_text[];
48+
49+
extern void phpdbg_do_help_cmd(char *type);
4850
#endif /* PHPDBG_HELP_H */

0 commit comments

Comments
 (0)