cvs: php4 /sapi/cli php_cli.c

From: Date: Sun, 27 Apr 2003 19:19:29 +0000
Subject: cvs: php4 /sapi/cli php_cli.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20529@lists.php.net to get a copy of this message
helly Sun Apr 27 15:19:29 2003 EDT Modified files: /php4/sapi/cli php_cli.c Log: split parameter parsing once more: do informal queries before others #still a memleak in case of a parameter conflict Index: php4/sapi/cli/php_cli.c diff -u php4/sapi/cli/php_cli.c:1.86 php4/sapi/cli/php_cli.c:1.87 --- php4/sapi/cli/php_cli.c:1.86 Wed Apr 23 18:52:44 2003 +++ php4/sapi/cli/php_cli.c Sun Apr 27 15:19:29 2003 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_cli.c,v 1.86 2003/04/23 22:52:44 helly Exp $ */ +/* $Id: php_cli.c,v 1.87 2003/04/27 19:19:29 helly Exp $ */ #include "php.h" #include "php_globals.h" @@ -603,14 +603,6 @@ zend_first_try { zend_llist_init(&global_vars, sizeof(char *), NULL, 0); - /* Set some CLI defaults */ - SG(options) |= SAPI_OPTION_NO_CHDIR; - /* here is the place for hard coded defaults which cannot be overwritten in the ini file */ - INI_HARDCODED("register_argc_argv", "1"); - INI_HARDCODED("html_errors", "0"); - INI_HARDCODED("implicit_flush", "1"); - INI_HARDCODED("max_execution_time", "0"); - zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ CG(in_compilation) = 0; /* not initialized but needed for several options */ EG(uninitialized_zval_ptr) = NULL; @@ -637,6 +629,63 @@ exit_status=1; goto out_err; + + case 'i': /* php info & quit */ + if (php_request_startup(TSRMLS_C)==FAILURE) { + goto err; + } + if (no_headers) { + SG(headers_sent) = 1; + SG(request_info).no_headers = 1; + } + php_print_info(0xFFFFFFFF TSRMLS_CC); + php_end_ob_buffers(1 TSRMLS_CC); + exit_status=1; + goto out; + + case 'm': /* list compiled in modules */ + php_output_startup(); + php_output_activate(TSRMLS_C); + SG(headers_sent) = 1; + php_printf("[PHP Modules]\n"); + print_modules(TSRMLS_C); + php_printf("\n[Zend Modules]\n"); + print_extensions(TSRMLS_C); + php_printf("\n"); + php_end_ob_buffers(1 TSRMLS_CC); + exit_status=1; + goto out_err; + + case 'v': /* show php version & quit */ + no_headers = 1; + if (php_request_startup(TSRMLS_C)==FAILURE) { + goto err; + } + if (no_headers) { + SG(headers_sent) = 1; + SG(request_info).no_headers = 1; + } + php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2003 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); + php_end_ob_buffers(1 TSRMLS_CC); + exit_status=1; + goto out; + + default: + break; + } + } + + /* Set some CLI defaults */ + SG(options) |= SAPI_OPTION_NO_CHDIR; + /* here is the place for hard coded defaults which cannot be overwritten in the ini file */ + INI_HARDCODED("register_argc_argv", "1"); + INI_HARDCODED("html_errors", "0"); + INI_HARDCODED("implicit_flush", "1"); + INI_HARDCODED("max_execution_time", "0"); + + while ((c = php_getopt(argc, argv, OPTIONS, &optarg, &optind, 0)) != -1) { + switch (c) { + case 'a': /* interactive mode */ printf("Interactive mode enabled\n\n"); interactive=1; @@ -688,19 +737,6 @@ } break; - case 'i': /* php info & quit */ - if (php_request_startup(TSRMLS_C)==FAILURE) { - goto err; - } - if (no_headers) { - SG(headers_sent) = 1; - SG(request_info).no_headers = 1; - } - php_print_info(0xFFFFFFFF TSRMLS_CC); - php_end_ob_buffers(1 TSRMLS_CC); - exit_status=1; - goto out; - case 'l': /* syntax check mode */ if (behavior != PHP_MODE_STANDARD) { break; @@ -709,19 +745,6 @@ behavior=PHP_MODE_LINT; break; - case 'm': /* list compiled in modules */ - php_output_startup(); - php_output_activate(TSRMLS_C); - SG(headers_sent) = 1; - php_printf("[PHP Modules]\n"); - print_modules(TSRMLS_C); - php_printf("\n[Zend Modules]\n"); - print_extensions(TSRMLS_C); - php_printf("\n"); - php_end_ob_buffers(1 TSRMLS_CC); - exit_status=1; - goto out_err; - #if 0 /* not yet operational, see also below ... */ case '': /* generate indented source mode*/ if (behavior == PHP_MODE_CLI_DIRECT || behavior == PHP_MODE_PROCESS_STDIN) { @@ -800,20 +823,6 @@ } behavior=PHP_MODE_HIGHLIGHT; break; - - case 'v': /* show php version & quit */ - no_headers = 1; - if (php_request_startup(TSRMLS_C)==FAILURE) { - goto err; - } - if (no_headers) { - SG(headers_sent) = 1; - SG(request_info).no_headers = 1; - } - php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2003 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); - php_end_ob_buffers(1 TSRMLS_CC); - exit_status=1; - goto out; case 'w': if (behavior == PHP_MODE_CLI_DIRECT || behavior == PHP_MODE_PROCESS_STDIN) {

« previous php.cvs (#20529) next »