From f3ac7fc9c6884b39f6c494c98e5fd417604fa53f Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Tue, 11 Feb 2003 16:18:42 +0000 Subject: Added -H option to CLI binary. This option can be used to hide any arguments including the script name passed to the CLI binary. --- sapi/cli/php_cli.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'sapi/cli/php_cli.c') diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 1bea0aabcd..a109680add 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -87,7 +87,7 @@ extern char *ap_php_optarg; extern int ap_php_optind; -#define OPTSTRING "aB:Cc:d:E:eF:f:g:hilmnqR:r:sw?vz:" +#define OPTSTRING "aB:Cc:d:E:eF:f:g:hilmnqRH:r:sw?vz" static int print_module_info(zend_module_entry *module, void *arg TSRMLS_DC) { @@ -317,6 +317,7 @@ static void php_cli_usage(char *argv0) " -R Run PHP for every input line\n" " -F Parse and execute for every input line\n" " -E Run PHP after processing all input lines\n" + " -H Hide any passed arguments\n" " -s Display colour syntax highlighted source.\n" " -v Version number\n" " -w Display source with stripped comments and whitespace.\n" @@ -471,6 +472,7 @@ int main(int argc, char *argv[]) char *exec_direct=NULL, *exec_run=NULL, *exec_begin=NULL, *exec_end=NULL; const char *param_error=NULL; int scan_input = 0; + int hide_argv = 0; /* end of temporary locals */ #ifdef ZTS zend_compiler_globals *compiler_globals; @@ -780,6 +782,9 @@ int main(int argc, char *argv[]) case 'z': /* load extension file */ zend_load_extension(ap_php_optarg); break; + case 'H': + hide_argv = 1; + break; default: break; @@ -844,6 +849,14 @@ int main(int argc, char *argv[]) } CG(start_lineno) = lineno; *arg_excp = arg_free; /* reconstuct argv */ + + if (hide_argv) { + int i; + for (i = 1; i < argc; i++) { + memset(argv[i], 0, strlen(argv[i])); + } + } + if (no_headers) { SG(headers_sent) = 1; SG(request_info).no_headers = 1; -- cgit v1.2.1