summaryrefslogtreecommitdiff
path: root/sapi/cli
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-02-11 16:18:42 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-02-11 16:18:42 +0000
commitf3ac7fc9c6884b39f6c494c98e5fd417604fa53f (patch)
tree17adec5a588d4ca59d89079774fbbc92d13d819e /sapi/cli
parentbeaf84ea17fd98b77f461591d67536887b44959e (diff)
downloadphp-git-f3ac7fc9c6884b39f6c494c98e5fd417604fa53f.tar.gz
Added -H option to CLI binary. This option can be used to hide any arguments
including the script name passed to the CLI binary.
Diffstat (limited to 'sapi/cli')
-rw-r--r--sapi/cli/php_cli.c15
1 files changed, 14 insertions, 1 deletions
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 <code> Run PHP <code> for every input line\n"
" -F <file> Parse and execute <file> for every input line\n"
" -E <end_code> Run PHP <end_code> 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;