|
|
| version 1.1.1.1, 2012/02/21 23:48:00 | version 1.1.1.2, 2012/05/29 12:34:42 |
|---|---|
| Line 26 | Line 26 |
| #include "php.h" | #include "php.h" |
| #include "php_readline.h" | #include "php_readline.h" |
| #include "readline_cli.h" | |
| #if HAVE_LIBREADLINE || HAVE_LIBEDIT | #if HAVE_LIBREADLINE || HAVE_LIBEDIT |
| Line 66 static zval *_readline_completion = NULL; | Line 67 static zval *_readline_completion = NULL; |
| static zval _readline_array; | static zval _readline_array; |
| PHP_MINIT_FUNCTION(readline); | PHP_MINIT_FUNCTION(readline); |
| PHP_MSHUTDOWN_FUNCTION(readline); | |
| PHP_RSHUTDOWN_FUNCTION(readline); | PHP_RSHUTDOWN_FUNCTION(readline); |
| PHP_MINFO_FUNCTION(readline); | |
| /* }}} */ | /* }}} */ |
| Line 141 static const zend_function_entry php_readline_function | Line 144 static const zend_function_entry php_readline_function |
| PHP_FE(readline_callback_read_char, arginfo_readline_callback_read_char) | PHP_FE(readline_callback_read_char, arginfo_readline_callback_read_char) |
| PHP_FE(readline_callback_handler_remove, arginfo_readline_callback_handler_remove) | PHP_FE(readline_callback_handler_remove, arginfo_readline_callback_handler_remove) |
| PHP_FE(readline_redisplay, arginfo_readline_redisplay) | PHP_FE(readline_redisplay, arginfo_readline_redisplay) |
| #endif | |
| #if HAVE_RL_ON_NEW_LINE | |
| PHP_FE(readline_on_new_line, arginfo_readline_on_new_line) | PHP_FE(readline_on_new_line, arginfo_readline_on_new_line) |
| #endif | #endif |
| PHP_FE_END | PHP_FE_END |
| Line 151 zend_module_entry readline_module_entry = { | Line 156 zend_module_entry readline_module_entry = { |
| "readline", | "readline", |
| php_readline_functions, | php_readline_functions, |
| PHP_MINIT(readline), | PHP_MINIT(readline), |
| PHP_MSHUTDOWN(readline), | |
| NULL, | NULL, |
| NULL, | |
| PHP_RSHUTDOWN(readline), | PHP_RSHUTDOWN(readline), |
| NULL, | PHP_MINFO(readline), |
| NO_VERSION_YET, | PHP_VERSION, |
| STANDARD_MODULE_PROPERTIES | STANDARD_MODULE_PROPERTIES |
| }; | }; |
| Line 166 ZEND_GET_MODULE(readline) | Line 171 ZEND_GET_MODULE(readline) |
| PHP_MINIT_FUNCTION(readline) | PHP_MINIT_FUNCTION(readline) |
| { | { |
| using_history(); | using_history(); |
| return SUCCESS; | return PHP_MINIT(cli_readline)(INIT_FUNC_ARGS_PASSTHRU); |
| } | } |
| PHP_MSHUTDOWN_FUNCTION(readline) | |
| { | |
| return PHP_MSHUTDOWN(cli_readline)(SHUTDOWN_FUNC_ARGS_PASSTHRU); | |
| } | |
| PHP_RSHUTDOWN_FUNCTION(readline) | PHP_RSHUTDOWN_FUNCTION(readline) |
| { | { |
| if (_readline_completion) { | if (_readline_completion) { |
| Line 186 PHP_RSHUTDOWN_FUNCTION(readline) | Line 196 PHP_RSHUTDOWN_FUNCTION(readline) |
| return SUCCESS; | return SUCCESS; |
| } | } |
| PHP_MINFO_FUNCTION(readline) | |
| { | |
| return PHP_MINFO(cli_readline)(ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU); | |
| } | |
| /* }}} */ | /* }}} */ |
| /* {{{ proto string readline([string prompt]) | /* {{{ proto string readline([string prompt]) |
| Line 365 PHP_FUNCTION(readline_read_history) | Line 380 PHP_FUNCTION(readline_read_history) |
| char *arg = NULL; | char *arg = NULL; |
| int arg_len; | int arg_len; |
| if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|p", &arg, &arg_len) == FAILURE) { |
| return; | return; |
| } | } |
| if (php_check_open_basedir(arg TSRMLS_CC)) { | |
| RETURN_FALSE; | |
| } | |
| /* XXX from & to NYI */ | /* XXX from & to NYI */ |
| if (read_history(arg)) { | if (read_history(arg)) { |
| RETURN_FALSE; | RETURN_FALSE; |
| Line 385 PHP_FUNCTION(readline_write_history) | Line 404 PHP_FUNCTION(readline_write_history) |
| char *arg = NULL; | char *arg = NULL; |
| int arg_len; | int arg_len; |
| if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) { | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|p", &arg, &arg_len) == FAILURE) { |
| return; | return; |
| } | } |
| if (php_check_open_basedir(arg TSRMLS_CC)) { | |
| RETURN_FALSE; | |
| } | |
| if (write_history(arg)) { | if (write_history(arg)) { |
| RETURN_FALSE; | RETURN_FALSE; |
| } else { | } else { |
| Line 561 PHP_FUNCTION(readline_callback_handler_install) | Line 584 PHP_FUNCTION(readline_callback_handler_install) |
| FREE_ZVAL(_prepped_callback); | FREE_ZVAL(_prepped_callback); |
| } | } |
| MAKE_STD_ZVAL(_prepped_callback); | ALLOC_ZVAL(_prepped_callback); |
| *_prepped_callback = *callback; | MAKE_COPY_ZVAL(&callback, _prepped_callback); |
| zval_copy_ctor(_prepped_callback); | |
| rl_callback_handler_install(prompt, php_rl_callback_handler); | rl_callback_handler_install(prompt, php_rl_callback_handler); |
| Line 604 PHP_FUNCTION(readline_redisplay) | Line 626 PHP_FUNCTION(readline_redisplay) |
| } | } |
| /* }}} */ | /* }}} */ |
| #endif | |
| #if HAVE_RL_ON_NEW_LINE | |
| /* {{{ proto void readline_on_new_line(void) | /* {{{ proto void readline_on_new_line(void) |
| Inform readline that the cursor has moved to a new line */ | Inform readline that the cursor has moved to a new line */ |
| PHP_FUNCTION(readline_on_new_line) | PHP_FUNCTION(readline_on_new_line) |