summaryrefslogtreecommitdiff
path: root/phpdbg_set.c
diff options
context:
space:
mode:
authorkrakjoe <joe.watkins@live.co.uk>2013-11-24 15:24:12 +0000
committerkrakjoe <joe.watkins@live.co.uk>2013-11-24 15:24:12 +0000
commite99fd228661163f152e97ebceb102929af11c092 (patch)
tree1f235e501e60186439e934032ac83467a5702673 /phpdbg_set.c
parentc7ef093095fa1a8c139b53643b96b997643ee643 (diff)
downloadphp-git-e99fd228661163f152e97ebceb102929af11c092.tar.gz
move oplog command to set commands
add help for set commands move set down in the list of prompt commands
Diffstat (limited to 'phpdbg_set.c')
-rw-r--r--phpdbg_set.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/phpdbg_set.c b/phpdbg_set.c
index 3c923a018c..3f9a262ac0 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;
+} /* }}} */
+