diff options
Diffstat (limited to 'sapi/cli/php_cli.c')
-rw-r--r-- | sapi/cli/php_cli.c | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 723decf065..fb6a898430 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -177,7 +177,7 @@ const opt_struct OPTIONS[] = { {'-', 0, NULL} /* end of args */ }; -static int print_module_info(zval *element TSRMLS_DC) /* {{{ */ +static int print_module_info(zval *element) /* {{{ */ { zend_module_entry *module = (zend_module_entry*)Z_PTR_P(element); php_printf("%s\n", module->name); @@ -185,7 +185,7 @@ static int print_module_info(zval *element TSRMLS_DC) /* {{{ */ } /* }}} */ -static int module_name_cmp(const void *a, const void *b TSRMLS_DC) /* {{{ */ +static int module_name_cmp(const void *a, const void *b) /* {{{ */ { Bucket *f = (Bucket *) a; Bucket *s = (Bucket *) b; @@ -195,40 +195,40 @@ static int module_name_cmp(const void *a, const void *b TSRMLS_DC) /* {{{ */ } /* }}} */ -static void print_modules(TSRMLS_D) /* {{{ */ +static void print_modules(void) /* {{{ */ { HashTable sorted_registry; zend_hash_init(&sorted_registry, 50, NULL, NULL, 0); zend_hash_copy(&sorted_registry, &module_registry, NULL); - zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC); - zend_hash_apply(&sorted_registry, print_module_info TSRMLS_CC); + zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0); + zend_hash_apply(&sorted_registry, print_module_info); zend_hash_destroy(&sorted_registry); } /* }}} */ -static int print_extension_info(zend_extension *ext, void *arg TSRMLS_DC) /* {{{ */ +static int print_extension_info(zend_extension *ext, void *arg) /* {{{ */ { php_printf("%s\n", ext->name); return ZEND_HASH_APPLY_KEEP; } /* }}} */ -static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s TSRMLS_DC) /* {{{ */ +static int extension_name_cmp(const zend_llist_element **f, const zend_llist_element **s) /* {{{ */ { return strcmp(((zend_extension *)(*f)->data)->name, ((zend_extension *)(*s)->data)->name); } /* }}} */ -static void print_extensions(TSRMLS_D) /* {{{ */ +static void print_extensions(void) /* {{{ */ { zend_llist sorted_exts; zend_llist_copy(&sorted_exts, &zend_extensions); sorted_exts.dtor = NULL; - zend_llist_sort(&sorted_exts, extension_name_cmp TSRMLS_CC); - zend_llist_apply(&sorted_exts, (llist_apply_func_t) print_extension_info TSRMLS_CC); + zend_llist_sort(&sorted_exts, extension_name_cmp); + zend_llist_apply(&sorted_exts, (llist_apply_func_t) print_extension_info); zend_llist_destroy(&sorted_exts); } /* }}} */ @@ -237,7 +237,7 @@ static void print_extensions(TSRMLS_D) /* {{{ */ #define STDOUT_FILENO 1 #endif -static inline int sapi_cli_select(int fd TSRMLS_DC) +static inline int sapi_cli_select(int fd) { fd_set wfd, dfd; struct timeval tv; @@ -256,7 +256,7 @@ static inline int sapi_cli_select(int fd TSRMLS_DC) return ret != -1; } -PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length TSRMLS_DC) /* {{{ */ +PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length) /* {{{ */ { #ifdef PHP_WRITE_STDOUT zend_long ret; @@ -266,7 +266,7 @@ PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length TSRM if (cli_shell_callbacks.cli_shell_write) { size_t shell_wrote; - shell_wrote = cli_shell_callbacks.cli_shell_write(str, str_length TSRMLS_CC); + shell_wrote = cli_shell_callbacks.cli_shell_write(str, str_length); if (shell_wrote > -1) { return shell_wrote; } @@ -275,7 +275,7 @@ PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length TSRM #ifdef PHP_WRITE_STDOUT do { ret = write(STDOUT_FILENO, str, str_length); - } while (ret <= 0 && errno == EAGAIN && sapi_cli_select(STDOUT_FILENO TSRMLS_CC)); + } while (ret <= 0 && errno == EAGAIN && sapi_cli_select(STDOUT_FILENO)); if (ret <= 0) { return 0; @@ -289,7 +289,7 @@ PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length TSRM } /* }}} */ -static size_t sapi_cli_ub_write(const char *str, size_t str_length TSRMLS_DC) /* {{{ */ +static size_t sapi_cli_ub_write(const char *str, size_t str_length) /* {{{ */ { const char *ptr = str; size_t remaining = str_length; @@ -301,7 +301,7 @@ static size_t sapi_cli_ub_write(const char *str, size_t str_length TSRMLS_DC) /* if (cli_shell_callbacks.cli_shell_ub_write) { size_t ub_wrote; - ub_wrote = cli_shell_callbacks.cli_shell_ub_write(str, str_length TSRMLS_CC); + ub_wrote = cli_shell_callbacks.cli_shell_ub_write(str, str_length); if (ub_wrote > -1) { return ub_wrote; } @@ -309,7 +309,7 @@ static size_t sapi_cli_ub_write(const char *str, size_t str_length TSRMLS_DC) /* while (remaining > 0) { - ret = sapi_cli_single_write(ptr, remaining TSRMLS_CC); + ret = sapi_cli_single_write(ptr, remaining); if (!ret) { #ifndef PHP_CLI_WIN32_NO_CONSOLE php_handle_aborted_connection(); @@ -324,7 +324,7 @@ static size_t sapi_cli_ub_write(const char *str, size_t str_length TSRMLS_DC) /* } /* }}} */ -static void sapi_cli_flush(void *server_context TSRMLS_DC) /* {{{ */ +static void sapi_cli_flush(void *server_context) /* {{{ */ { /* Ignore EBADF here, it's caused by the fact that STDIN/STDOUT/STDERR streams * are/could be closed before fflush() is called. @@ -340,7 +340,7 @@ static void sapi_cli_flush(void *server_context TSRMLS_DC) /* {{{ */ static char *php_self = ""; static char *script_filename = ""; -static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC) /* {{{ */ +static void sapi_cli_register_variables(zval *track_vars_array) /* {{{ */ { size_t len; char *docroot = ""; @@ -348,39 +348,39 @@ static void sapi_cli_register_variables(zval *track_vars_array TSRMLS_DC) /* {{{ /* In CGI mode, we consider the environment to be a part of the server * variables */ - php_import_environment_variables(track_vars_array TSRMLS_CC); + php_import_environment_variables(track_vars_array); /* Build the special-case PHP_SELF variable for the CLI version */ len = strlen(php_self); - if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &php_self, len, &len TSRMLS_CC)) { - php_register_variable("PHP_SELF", php_self, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, "PHP_SELF", &php_self, len, &len)) { + php_register_variable("PHP_SELF", php_self, track_vars_array); } - if (sapi_module.input_filter(PARSE_SERVER, "SCRIPT_NAME", &php_self, len, &len TSRMLS_CC)) { - php_register_variable("SCRIPT_NAME", php_self, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, "SCRIPT_NAME", &php_self, len, &len)) { + php_register_variable("SCRIPT_NAME", php_self, track_vars_array); } /* filenames are empty for stdin */ len = strlen(script_filename); - if (sapi_module.input_filter(PARSE_SERVER, "SCRIPT_FILENAME", &script_filename, len, &len TSRMLS_CC)) { - php_register_variable("SCRIPT_FILENAME", script_filename, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, "SCRIPT_FILENAME", &script_filename, len, &len)) { + php_register_variable("SCRIPT_FILENAME", script_filename, track_vars_array); } - if (sapi_module.input_filter(PARSE_SERVER, "PATH_TRANSLATED", &script_filename, len, &len TSRMLS_CC)) { - php_register_variable("PATH_TRANSLATED", script_filename, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, "PATH_TRANSLATED", &script_filename, len, &len)) { + php_register_variable("PATH_TRANSLATED", script_filename, track_vars_array); } /* just make it available */ len = 0U; - if (sapi_module.input_filter(PARSE_SERVER, "DOCUMENT_ROOT", &docroot, len, &len TSRMLS_CC)) { - php_register_variable("DOCUMENT_ROOT", docroot, track_vars_array TSRMLS_CC); + if (sapi_module.input_filter(PARSE_SERVER, "DOCUMENT_ROOT", &docroot, len, &len)) { + php_register_variable("DOCUMENT_ROOT", docroot, track_vars_array); } } /* }}} */ -static void sapi_cli_log_message(char *message TSRMLS_DC) /* {{{ */ +static void sapi_cli_log_message(char *message) /* {{{ */ { fprintf(stderr, "%s\n", message); } /* }}} */ -static int sapi_cli_deactivate(TSRMLS_D) /* {{{ */ +static int sapi_cli_deactivate(void) /* {{{ */ { fflush(stdout); if(SG(request_info).argv0) { @@ -391,19 +391,19 @@ static int sapi_cli_deactivate(TSRMLS_D) /* {{{ */ } /* }}} */ -static char* sapi_cli_read_cookies(TSRMLS_D) /* {{{ */ +static char* sapi_cli_read_cookies(void) /* {{{ */ { return NULL; } /* }}} */ -static int sapi_cli_header_handler(sapi_header_struct *h, sapi_header_op_enum op, sapi_headers_struct *s TSRMLS_DC) /* {{{ */ +static int sapi_cli_header_handler(sapi_header_struct *h, sapi_header_op_enum op, sapi_headers_struct *s) /* {{{ */ { return 0; } /* }}} */ -static int sapi_cli_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) /* {{{ */ +static int sapi_cli_send_headers(sapi_headers_struct *sapi_headers) /* {{{ */ { /* We do nothing here, this function is needed to prevent that the fallback * header handling is called. */ @@ -411,7 +411,7 @@ static int sapi_cli_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) /* } /* }}} */ -static void sapi_cli_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC) /* {{{ */ +static void sapi_cli_send_header(sapi_header_struct *sapi_header, void *server_context) /* {{{ */ { } /* }}} */ @@ -553,7 +553,7 @@ static void php_cli_usage(char *argv0) static php_stream *s_in_process = NULL; -static void cli_register_file_handles(TSRMLS_D) /* {{{ */ +static void cli_register_file_handles(void) /* {{{ */ { zval zin, zout, zerr; php_stream *s_in, *s_out, *s_err; @@ -587,19 +587,19 @@ static void cli_register_file_handles(TSRMLS_D) /* {{{ */ ic.flags = CONST_CS; ic.name = zend_string_init("STDIN", sizeof("STDIN")-1, 1); ic.module_number = 0; - zend_register_constant(&ic TSRMLS_CC); + zend_register_constant(&ic); ZVAL_COPY_VALUE(&oc.value, &zout); oc.flags = CONST_CS; oc.name = zend_string_init("STDOUT", sizeof("STDOUT")-1, 1); oc.module_number = 0; - zend_register_constant(&oc TSRMLS_CC); + zend_register_constant(&oc); ZVAL_COPY_VALUE(&ec.value, &zerr); ec.flags = CONST_CS; ec.name = zend_string_init("STDERR", sizeof("STDERR")-1, 1); ec.module_number = 0; - zend_register_constant(&ec TSRMLS_CC); + zend_register_constant(&ec); } /* }}} */ @@ -607,7 +607,7 @@ static const char *param_mode_conflict = "Either execute direct code, process st /* {{{ cli_seek_file_begin */ -static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file, int *lineno TSRMLS_DC) +static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file, int *lineno) { int c; @@ -644,7 +644,7 @@ static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file, } /* }}} */ -static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ +static int do_cli(int argc, char **argv) /* {{{ */ { int c; zend_file_handle file_handle; @@ -671,12 +671,12 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ switch (c) { case 'i': /* php info & quit */ - if (php_request_startup(TSRMLS_C)==FAILURE) { + if (php_request_startup()==FAILURE) { goto err; } request_started = 1; - php_print_info(0xFFFFFFFF TSRMLS_CC); - php_output_end_all(TSRMLS_C); + php_print_info(0xFFFFFFFF); + php_output_end_all(); exit_status = (c == '?' && argc > 1 && !strchr(argv[1], c)); goto out; @@ -694,20 +694,20 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ #endif get_zend_version() ); - sapi_deactivate(TSRMLS_C); + sapi_deactivate(); goto out; case 'm': /* list compiled in modules */ - if (php_request_startup(TSRMLS_C)==FAILURE) { + if (php_request_startup()==FAILURE) { goto err; } request_started = 1; php_printf("[PHP Modules]\n"); - print_modules(TSRMLS_C); + print_modules(); php_printf("\n[Zend Modules]\n"); - print_extensions(TSRMLS_C); + print_extensions(); php_printf("\n"); - php_output_end_all(TSRMLS_C); + php_output_end_all(); exit_status=0; goto out; @@ -858,7 +858,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ break; case 'z': /* load extension file */ - zend_load_extension(php_optarg TSRMLS_CC); + zend_load_extension(php_optarg); break; case 'H': hide_argv = 1; @@ -917,7 +917,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ php_optind++; } if (script_file) { - if (cli_seek_file_begin(&file_handle, script_file, &lineno TSRMLS_CC) != SUCCESS) { + if (cli_seek_file_begin(&file_handle, script_file, &lineno) != SUCCESS) { goto err; } else { char real_path[MAXPATHLEN]; @@ -948,7 +948,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ argv[php_optind-1] = (char*)file_handle.filename; SG(request_info).argv=argv+php_optind-1; - if (php_request_startup(TSRMLS_C)==FAILURE) { + if (php_request_startup()==FAILURE) { *arg_excp = arg_free; fclose(file_handle.handle.fp); PUTS("Could not startup.\n"); @@ -966,25 +966,25 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ } key = zend_string_init("_SERVER", sizeof("_SERVER")-1, 0); - zend_is_auto_global(key TSRMLS_CC); + zend_is_auto_global(key); zend_string_release(key); PG(during_request_startup) = 0; switch (behavior) { case PHP_MODE_STANDARD: if (strcmp(file_handle.filename, "-")) { - cli_register_file_handles(TSRMLS_C); + cli_register_file_handles(); } if (interactive && cli_shell_callbacks.cli_shell_run) { - exit_status = cli_shell_callbacks.cli_shell_run(TSRMLS_C); + exit_status = cli_shell_callbacks.cli_shell_run(); } else { - php_execute_script(&file_handle TSRMLS_CC); + php_execute_script(&file_handle); exit_status = EG(exit_status); } break; case PHP_MODE_LINT: - exit_status = php_lint_script(&file_handle TSRMLS_CC); + exit_status = php_lint_script(&file_handle); if (exit_status==SUCCESS) { zend_printf("No syntax errors detected in %s\n", file_handle.filename); } else { @@ -992,8 +992,8 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ } break; case PHP_MODE_STRIP: - if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) { - zend_strip(TSRMLS_C); + if (open_file_for_scanning(&file_handle)==SUCCESS) { + zend_strip(); } goto out; break; @@ -1001,9 +1001,9 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ { zend_syntax_highlighter_ini syntax_highlighter_ini; - if (open_file_for_scanning(&file_handle TSRMLS_CC)==SUCCESS) { + if (open_file_for_scanning(&file_handle)==SUCCESS) { php_get_highlight_struct(&syntax_highlighter_ini); - zend_highlight(&syntax_highlighter_ini TSRMLS_CC); + zend_highlight(&syntax_highlighter_ini); } goto out; } @@ -1011,15 +1011,15 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ #if 0 /* Zeev might want to do something with this one day */ case PHP_MODE_INDENT: - open_file_for_scanning(&file_handle TSRMLS_CC); - zend_indent(TSRMLS_C); - zend_file_handle_dtor(file_handle.handle TSRMLS_CC); + open_file_for_scanning(&file_handle); + zend_indent(); + zend_file_handle_dtor(file_handle.handle); goto out; break; #endif case PHP_MODE_CLI_DIRECT: - cli_register_file_handles(TSRMLS_C); - if (zend_eval_string_ex(exec_direct, NULL, "Command line code", 1 TSRMLS_CC) == FAILURE) { + cli_register_file_handles(); + if (zend_eval_string_ex(exec_direct, NULL, "Command line code", 1) == FAILURE) { exit_status=254; } break; @@ -1030,9 +1030,9 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ size_t len, index = 0; zval argn, argi; - cli_register_file_handles(TSRMLS_C); + cli_register_file_handles(); - if (exec_begin && zend_eval_string_ex(exec_begin, NULL, "Command line begin code", 1 TSRMLS_CC) == FAILURE) { + if (exec_begin && zend_eval_string_ex(exec_begin, NULL, "Command line begin code", 1) == FAILURE) { exit_status=254; } ZVAL_LONG(&argi, index); @@ -1046,23 +1046,23 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ zend_hash_str_update(&EG(symbol_table).ht, "argn", sizeof("argn")-1, &argn); Z_LVAL(argi) = ++index; if (exec_run) { - if (zend_eval_string_ex(exec_run, NULL, "Command line run code", 1 TSRMLS_CC) == FAILURE) { + if (zend_eval_string_ex(exec_run, NULL, "Command line run code", 1) == FAILURE) { exit_status=254; } } else { if (script_file) { - if (cli_seek_file_begin(&file_handle, script_file, &lineno TSRMLS_CC) != SUCCESS) { + if (cli_seek_file_begin(&file_handle, script_file, &lineno) != SUCCESS) { exit_status = 1; } else { CG(start_lineno) = lineno; - php_execute_script(&file_handle TSRMLS_CC); + php_execute_script(&file_handle); exit_status = EG(exit_status); } } } efree(input); } - if (exec_end && zend_eval_string_ex(exec_end, NULL, "Command line end code", 1 TSRMLS_CC) == FAILURE) { + if (exec_end && zend_eval_string_ex(exec_end, NULL, "Command line end code", 1) == FAILURE) { exit_status=254; } @@ -1110,7 +1110,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ zval tmp, *msg; ZVAL_OBJ(&tmp, EG(exception)); - msg = zend_read_property(zend_exception_get_default(TSRMLS_C), &tmp, "message", sizeof("message")-1, 0 TSRMLS_CC); + msg = zend_read_property(zend_exception_get_default(), &tmp, "message", sizeof("message")-1, 0); zend_printf("Exception: %s\n", Z_STRVAL_P(msg)); zval_ptr_dtor(&tmp); EG(exception) = NULL; @@ -1136,7 +1136,7 @@ static int do_cli(int argc, char **argv TSRMLS_DC) /* {{{ */ exit_status = 1; } } else { - php_info_print_module(module TSRMLS_CC); + php_info_print_module(module); } efree(lcname); @@ -1166,8 +1166,8 @@ out: } return exit_status; err: - sapi_deactivate(TSRMLS_C); - zend_ini_deactivate(TSRMLS_C); + sapi_deactivate(); + zend_ini_deactivate(); exit_status = 1; goto out; } @@ -1358,10 +1358,10 @@ exit_loop: #ifndef PHP_CLI_WIN32_NO_CONSOLE if (sapi_module == &cli_sapi_module) { #endif - exit_status = do_cli(argc, argv TSRMLS_CC); + exit_status = do_cli(argc, argv); #ifndef PHP_CLI_WIN32_NO_CONSOLE } else { - exit_status = do_cli_server(argc, argv TSRMLS_CC); + exit_status = do_cli_server(argc, argv); } #endif } zend_end_try(); @@ -1373,7 +1373,7 @@ out: free(ini_entries); } if (module_started) { - php_module_shutdown(TSRMLS_C); + php_module_shutdown(); } if (sapi_started) { sapi_shutdown(); |