com php-src: move oplog command to set commands add help for set commands move set down in the list of prompt commands: phpdbg_help.c phpdbg_help.h
phpdbg_prompt.c phpdbg_set.c phpdbg_set.h
| From: | Bob Weinand | Date: | Sun, 24 Nov 2013 15:24:12 +0000 |
| Subject: | com php-src: move oplog command to set commands add help for set commands move set down in the list of prompt commands: phpdbg_help.c phpdbg_help.h phpdbg_prompt.c phpdbg_set.c phpdbg_set.h |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74647@lists.php.net to get a copy of this message | ||
Commit: e99fd228661163f152e97ebceb102929af11c092
Author: krakjoe <joe.watkins@live.co.uk> Sun, 24 Nov 2013 15:24:12 +0000
Parents: c7ef093095fa1a8c139b53643b96b997643ee643
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e99fd228661163f152e97ebceb102929af11c092
Log:
move oplog command to set commands
add help for set commands
move set down in the list of prompt commands
Changed paths:
M phpdbg_help.c
M phpdbg_help.h
M phpdbg_prompt.c
M phpdbg_set.c
M phpdbg_set.h
Diff:
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 3a699d6..09f1625 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -24,6 +24,7 @@
#include "phpdbg_break.h"
#include "phpdbg_list.h"
#include "phpdbg_info.h"
+#include "phpdbg_set.h"
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
@@ -430,7 +431,28 @@ PHPDBG_HELP(oplog) /* {{{ */
phpdbg_writeln("Note: upon failure to open a new oplog, the last oplog is held open");
phpdbg_help_footer();
return SUCCESS;
-}
+} /* }}} */
+
+PHPDBG_HELP(set) /* {{{ */
+{
+ phpdbg_help_header();
+ phpdbg_writeln("Configure how phpdbg looks and behaves with the set command");
+ phpdbg_writeln("Specific set commands are show below:");
+ phpdbg_notice("Commands");
+ {
+ const phpdbg_command_t *set_command = phpdbg_set_commands;
+
+ phpdbg_writeln("\tAlias\tCommand\t\tPurpose");
+ while (set_command && set_command->name) {
+ if (set_command->alias) {
+ phpdbg_writeln("\t[%c]\t%s\t\t%s", set_command->alias, set_command->name,
set_command->tip);
+ } else phpdbg_writeln("\t[ ]\t%s\t\t%s", set_command->name, set_command->tip);
+ ++set_command;
+ }
+ }
+ phpdbg_help_footer();
+ return SUCCESS;
+} /* }}} */
PHPDBG_HELP(register) /* {{{ */
{
diff --git a/phpdbg_help.h b/phpdbg_help.h
index 8ec9ee2..d1e37ac 100644
--- a/phpdbg_help.h
+++ b/phpdbg_help.h
@@ -47,7 +47,7 @@ PHPDBG_HELP(back);
PHPDBG_HELP(frame);
PHPDBG_HELP(quiet);
PHPDBG_HELP(list);
-PHPDBG_HELP(oplog);
+PHPDBG_HELP(set);
PHPDBG_HELP(register);
PHPDBG_HELP(options);
PHPDBG_HELP(shell);
@@ -74,7 +74,7 @@ static const phpdbg_command_t phpdbg_help_commands[] = {
PHPDBG_COMMAND_D_EX(frame, "switch to a frame in the current stack for inspection",
'f', help_frame, NULL, 0),
PHPDBG_COMMAND_D_EX(quiet, "be quiet during execution",
'Q', help_quiet, NULL, 0),
PHPDBG_COMMAND_D_EX(list, "list code gives you quick access to code",
'l', help_list, NULL, 0),
- PHPDBG_COMMAND_D_EX(oplog, "keep clutter off the screen by logging oplines",
'O', help_oplog, NULL, 0),
+ PHPDBG_COMMAND_D_EX(set, "configure how phpdbg looks and behaves",
'S', help_set, NULL, 0),
PHPDBG_COMMAND_D_EX(register, "register a function for use as a command",
'R', help_register,NULL, 0),
PHPDBG_COMMAND_D_EX(options, "show information about command line options",
'o', help_options, NULL, 0),
PHPDBG_COMMAND_D_EX(shell, "execute system commands with direct shell access",
'-', help_shell, NULL, 0),
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index da16df7..2671480 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -46,7 +46,6 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
PHPDBG_COMMAND_D(until, "continue past the current line", 'u',
NULL, 0),
PHPDBG_COMMAND_D(finish, "continue past the end of the stack", 'F',
NULL, 0),
PHPDBG_COMMAND_D(leave, "continue until the end of the stack", 'L',
NULL, 0),
- PHPDBG_COMMAND_D(set, "set debug properties", 'S',
phpdbg_set_commands, 1),
PHPDBG_COMMAND_D(print, "print something", 'p',
phpdbg_print_commands, 2),
PHPDBG_COMMAND_D(break, "set breakpoint", 'b',
phpdbg_break_commands, 1),
PHPDBG_COMMAND_D(back, "show trace", 't',
NULL, 0),
@@ -58,7 +57,7 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
PHPDBG_COMMAND_D(help, "show help menu", 'h',
phpdbg_help_commands, 2),
PHPDBG_COMMAND_D(quiet, "silence some output", 'Q',
NULL, 1),
PHPDBG_COMMAND_D(aliases, "show alias list", 'a',
NULL, 0),
- PHPDBG_COMMAND_D(oplog, "sets oplog output", 'O',
NULL, 1),
+ PHPDBG_COMMAND_D(set, "set phpdbg configuration", 'S',
phpdbg_set_commands, 1),
PHPDBG_COMMAND_D(register,"register a function", 'R',
NULL, 1),
PHPDBG_COMMAND_D(shell, "shell a command", '-',
NULL, 1),
PHPDBG_COMMAND_D(quit, "exit phpdbg", 'q',
NULL, 0),
@@ -931,48 +930,6 @@ PHPDBG_COMMAND(aliases) /* {{{ */
return SUCCESS;
} /* }}} */
-PHPDBG_COMMAND(oplog) /* {{{ */
-{
- switch (param->type) {
- case EMPTY_PARAM:
- case NUMERIC_PARAM:
- if ((param->type != NUMERIC_PARAM) || !param->num) {
- if (PHPDBG_G(oplog)) {
- phpdbg_notice("Disabling oplog");
- fclose(
- PHPDBG_G(oplog));
- } else {
- phpdbg_error("No oplog currently open !");
- }
- } else {
- phpdbg_error(
- "No action taken !");
- }
- break;
-
- case STR_PARAM: {
- /* open oplog */
- FILE *old = PHPDBG_G(oplog);
-
- PHPDBG_G(oplog) = fopen(param->str, "w+");
- if (!PHPDBG_G(oplog)) {
- phpdbg_error("Failed to open %s for oplog", param->str);
- PHPDBG_G(oplog) = old;
- } else {
- if (old) {
- phpdbg_notice("Closing previously open oplog");
- fclose(old);
- }
- phpdbg_notice("Successfully opened oplog %s", param->str);
- }
- } break;
-
- phpdbg_default_switch_case();
- }
-
- return SUCCESS;
-} /* }}} */
-
PHPDBG_COMMAND(help) /* {{{ */
{
switch (param->type) {
diff --git a/phpdbg_set.c b/phpdbg_set.c
index 3c923a0..3f9a262 100644
--- a/phpdbg_set.c
+++ b/phpdbg_set.c
@@ -55,3 +55,51 @@ PHPDBG_SET(prompt) /* {{{ */
return SUCCESS;
} /* }}} */
+PHPDBG_SET(oplog) /* {{{ */
+{
+ switch (param->type) {
+ case EMPTY_PARAM:
+ phpdbg_notice(
+ "Oplog %s", PHPDBG_G(oplog) ? "enabled" : "disabled");
+ break;
+
+ case NUMERIC_PARAM: switch (param->num) {
+ case 1:
+ phpdbg_error(
+ "An output file must be provided to enable oplog");
+ break;
+
+ case 0: {
+ if (PHPDBG_G(oplog)) {
+ phpdbg_notice("Disabling oplog");
+ fclose(
+ PHPDBG_G(oplog));
+ } else {
+ phpdbg_error("Oplog is not enabled !");
+ }
+ } break;
+ } break;
+
+ case STR_PARAM: {
+ /* open oplog */
+ FILE *old = PHPDBG_G(oplog);
+
+ PHPDBG_G(oplog) = fopen(param->str, "w+");
+ if (!PHPDBG_G(oplog)) {
+ phpdbg_error("Failed to open %s for oplog", param->str);
+ PHPDBG_G(oplog) = old;
+ } else {
+ if (old) {
+ phpdbg_notice("Closing previously open oplog");
+ fclose(old);
+ }
+ phpdbg_notice("Successfully opened oplog %s", param->str);
+ }
+ } break;
+
+ phpdbg_default_switch_case();
+ }
+
+ return SUCCESS;
+} /* }}} */
+
diff --git a/phpdbg_set.h b/phpdbg_set.h
index e523364..e691a81 100644
--- a/phpdbg_set.h
+++ b/phpdbg_set.h
@@ -28,9 +28,11 @@ void phpdbg_set_prompt(const char* TSRMLS_DC);
const char* phpdbg_get_prompt(TSRMLS_D);
PHPDBG_SET(prompt);
+PHPDBG_SET(oplog);
static const phpdbg_command_t phpdbg_set_commands[] = {
PHPDBG_COMMAND_D_EX(prompt, "set prompt", 'p', set_prompt,
NULL, 0),
+ PHPDBG_COMMAND_D_EX(oplog, "set oplog output", 'O', set_oplog,
NULL, 0),
PHPDBG_END_COMMAND
};