]> granicus.if.org Git - php/commitdiff
phpdbg_init from file & command line option (no impl yet)
authorkrakjoe <joe.watkins@live.co.uk>
Thu, 14 Nov 2013 14:14:13 +0000 (14:14 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Thu, 14 Nov 2013 14:14:13 +0000 (14:14 +0000)
phpdbg.c
phpdbg_prompt.c
phpdbg_prompt.h

index 4accf2fa4a07a4888c71133ec5fc009bf12dc39b..207e4ca0edfff070222a92a808a65601e38ff51f 100644 (file)
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -296,6 +296,7 @@ const opt_struct OPTIONS[] = { /* {{{ */
        {'v', 0, "verbose"},
        {'s', 0, "step"},
        {'b', 0, "boring colours"},
+       {'i', 1, "init"},
        {'-', 0, NULL}
 }; /* }}} */
 
@@ -321,8 +322,6 @@ void phpdbg_ini_defaults(HashTable *configuration_hash) /* {{{ */
        INI_DEFAULT("display_errors", "1");
 } /* }}} */
 
-static jmp_buf phpdbg_main;
-
 int main(int argc, char **argv) /* {{{ */
 {
        sapi_module_struct *phpdbg = &phpdbg_sapi_module;
@@ -330,6 +329,8 @@ int main(int argc, char **argv) /* {{{ */
        int   ini_entries_len;
        char *exec;
        size_t exec_len;
+       char *init_file;
+       size_t init_file_len;
        zend_ulong flags;
        char *php_optarg;
     int php_optind;
@@ -358,6 +359,8 @@ phpdbg_main:
     ini_entries_len = 0;
     exec = NULL;
     exec_len = 0;
+    init_file = NULL;
+    init_file_len = 0;
     flags = PHPDBG_DEFAULT_FLAGS;
     php_optarg = NULL;
     php_optind = 1;
@@ -413,6 +416,13 @@ phpdbg_main:
                     exec = strdup(php_optarg);
                 }
             break;
+            
+            case 'i': /* set init file */
+                init_file_len = strlen(php_optarg);
+                if (init_file_len) {
+                    init_file = strdup(php_optarg);
+                }
+            break;
 
             case 'v': /* set quietness off */
                 flags &= ~PHPDBG_IS_QUIET;
@@ -476,6 +486,9 @@ phpdbg_main:
                        zend_activate_modules(TSRMLS_C);
                } zend_end_try();
 
+        /* initialize from file */
+        phpdbg_init(init_file, init_file_len TSRMLS_CC);
+
         /* print blurb */
                phpdbg_welcome(cleaning TSRMLS_CC);
 
index 91e99905832a6b277307c16406892727b5194a19..7d20580922fcae7e703be1194a24ed1582d5cae9 100644 (file)
@@ -71,6 +71,14 @@ static const phpdbg_command_t phpdbg_prompt_commands[] = {
 
 ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
 
+void phpdbg_init(char *init_file, size_t init_file_len TSRMLS_DC) /* {{{ */
+{
+    if (init_file) {
+        
+        free(init_file);
+    }
+} /* }}} */
+
 void phpdbg_welcome(zend_bool cleaning TSRMLS_DC) /* {{{ */
 {
     /* print blurb */
index b7d710109e411ae4eb1b3ee24b54b25accc8ab40..2ffe672c8028bc2e3bf883cbb6104a655d0a1268 100644 (file)
@@ -61,6 +61,7 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le
 #define PHPDBG_COMMAND(name) \
        int phpdbg_do_##name(const char *expr, size_t expr_len TSRMLS_DC)
 
+void phpdbg_init(char *init_file, size_t init_file_len TSRMLS_DC);
 void phpdbg_welcome(zend_bool cleaning TSRMLS_DC);
 int phpdbg_interactive(TSRMLS_D);
 void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC);