helly           Sat May  5 16:21:07 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/sapi/cli   php_cli.c 
  Log:
  - MFH --ri does not require ext/Reflection
  - MFH --ini to show ini files being used
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.129.2.13.2.18&r2=1.129.2.13.2.19&diff_format=u
Index: php-src/sapi/cli/php_cli.c
diff -u php-src/sapi/cli/php_cli.c:1.129.2.13.2.18 
php-src/sapi/cli/php_cli.c:1.129.2.13.2.19
--- php-src/sapi/cli/php_cli.c:1.129.2.13.2.18  Wed Apr 25 09:56:29 2007
+++ php-src/sapi/cli/php_cli.c  Sat May  5 16:21:07 2007
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_cli.c,v 1.129.2.13.2.18 2007/04/25 09:56:29 bjori Exp $ */
+/* $Id: php_cli.c,v 1.129.2.13.2.19 2007/05/05 16:21:07 helly Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -91,6 +91,9 @@
 
 #include "php_getopt.h"
 
+PHPAPI extern char *php_ini_opened_path;
+PHPAPI extern char *php_ini_scanned_files;
+
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
@@ -106,6 +109,7 @@
 #define PHP_MODE_REFLECTION_CLASS       9
 #define PHP_MODE_REFLECTION_EXTENSION   10
 #define PHP_MODE_REFLECTION_EXT_INFO    11
+#define PHP_MODE_SHOW_INI_CONFIG        12
 
 #define HARDCODED_INI                  \
        "html_errors=0\n"                       \
@@ -153,16 +157,17 @@
        {11,  1, "rclass"},
        {12,  1, "re"},
        {12,  1, "rextension"},
+#endif
        {13,  1, "ri"},
        {13,  1, "rextinfo"},
-#endif
+       {14,  0, "ini"},
        {'-', 0, NULL} /* end of args */
 };
 
-static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
+static int print_module_info(zend_module_entry *module TSRMLS_DC)
 {
        php_printf("%s\n", module->name);
-       return 0;
+       return ZEND_HASH_APPLY_KEEP;
 }
 
 static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
@@ -182,14 +187,14 @@
        zend_hash_init(&sorted_registry, 50, NULL, NULL, 1);
        zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp, 
sizeof(zend_module_entry));
        zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 
TSRMLS_CC);
-       zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) 
print_module_info, NULL TSRMLS_CC);
+       zend_hash_apply(&sorted_registry, (apply_func_t) print_module_info 
TSRMLS_CC);
        zend_hash_destroy(&sorted_registry);
 }
 
 static int print_extension_info(zend_extension *ext, void *arg TSRMLS_DC)
 {
        php_printf("%s\n", ext->name);
-       return 0;
+       return ZEND_HASH_APPLY_KEEP;
 }
 
 static int extension_name_cmp(const zend_llist_element **f,
@@ -206,7 +211,7 @@
        zend_llist_copy(&sorted_exts, &zend_extensions);
        sorted_exts.dtor = NULL;
        zend_llist_sort(&sorted_exts, extension_name_cmp TSRMLS_CC);
-       zend_llist_apply_with_argument(&sorted_exts, 
(llist_apply_with_arg_func_t) print_extension_info, NULL TSRMLS_CC);
+       zend_llist_apply(&sorted_exts, (llist_apply_func_t) 
print_extension_info TSRMLS_CC);
        zend_llist_destroy(&sorted_exts);
 }
 
@@ -448,13 +453,15 @@
                                "  args...          Arguments passed to script. 
Use -- args when first argument\n"
                                "                   starts with - or script is 
read from stdin\n"
                                "\n"
+                               "  --ini            Show configuration file 
names\n"
+                               "\n"
 #if (HAVE_REFLECTION)
                                "  --rf <name>      Show information about 
function <name>.\n"
                                "  --rc <name>      Show information about 
class <name>.\n"
                                "  --re <name>      Show information about 
extension <name>.\n"
+#endif
                                "  --ri <name>      Show configuration for 
extension <name>.\n"
                                "\n"
-#endif
                                , prog, prog, prog, prog, prog, prog);
 }
 /* }}} */
@@ -959,11 +966,14 @@
                                behavior=PHP_MODE_REFLECTION_EXTENSION;
                                reflection_what = php_optarg;
                                break;
+#endif
                        case 13:
                                behavior=PHP_MODE_REFLECTION_EXT_INFO;
                                reflection_what = php_optarg;
                                break;
-#endif
+                       case 14:
+                               behavior = PHP_MODE_SHOW_INI_CONFIG;
+                               break;
                        default:
                                break;
                        }
@@ -1231,6 +1241,8 @@
                                        zend_execute_data execute_data;
 
                                        switch (behavior) {
+                                               default:
+                                                       break;
                                                case 
PHP_MODE_REFLECTION_FUNCTION:
                                                        if 
(strstr(reflection_what, "::")) {
                                                                pce = 
reflection_method_ptr;
@@ -1270,6 +1282,7 @@
 
                                        break;
                                }
+#endif /* reflection */
                        case PHP_MODE_REFLECTION_EXT_INFO:
                                {
                                        int len = strlen(reflection_what);
@@ -1290,7 +1303,14 @@
                                        efree(lcname);
                                        break;
                                }
-#endif /* reflection */
+                       case PHP_MODE_SHOW_INI_CONFIG:
+                               {
+                                       zend_printf("Configuration File 
(php.ini) Path: %s\n", PHP_CONFIG_FILE_PATH);
+                                       zend_printf("Loaded Configuration File: 
        %s\n", php_ini_opened_path ? php_ini_opened_path : "(none)");
+                                       zend_printf("Scan for additional .ini 
files in: %s\n", *PHP_CONFIG_FILE_SCAN_DIR ? PHP_CONFIG_FILE_SCAN_DIR : 
"(none)");
+                                       zend_printf("Additional .ini files 
parsed:      %s\n", php_ini_scanned_files ? php_ini_scanned_files : "(none)");
+                                       break;
+                               }
                        }
                }
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to