]> granicus.if.org Git - php/commitdiff
move oplog command to set commands
authorkrakjoe <joe.watkins@live.co.uk>
Sun, 24 Nov 2013 15:24:12 +0000 (15:24 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Sun, 24 Nov 2013 15:24:12 +0000 (15:24 +0000)
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

index 3a699d69f05a65dbbac08e63c014cce8da03fec2..09f16252d36139d676d17fcf23c0f27a60a65c3c 100644 (file)
@@ -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) /* {{{ */
 {
index 8ec9ee235fd3f9eba8abb54542d780c627c5c53f..d1e37ace5eaab4ec5ce25b15e1aff50e7425b9c4 100644 (file)
@@ -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),
index da16df7cfc3710b89e9e29b272d19ccb0ff5ba48..2671480c2ac4c7e0c8c290536303a63de795bf31 100644 (file)
@@ -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) {
index 3c923a018c101273e2a43d399400d6c078bb24d3..3f9a262ac0092dc3dfa26d234c31ab5eb37c02c4 100644 (file)
@@ -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;
+} /* }}} */
+
index e523364519382828e89c65ac3ec251f9c139635c..e691a8195f443ef3d0d6419275a2fd8081870b3a 100644 (file)
@@ -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
 };