com php-src: reworked the current EOL stuff: config.m4 config.w32 phpdbg.c phpdbg.h phpdbg_prompt.c
| From: | Bob Weinand | Date: | Tue, 21 Oct 2014 09:47:21 +0000 |
| Subject: | com php-src: reworked the current EOL stuff: config.m4 config.w32 phpdbg.c phpdbg.h phpdbg_prompt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82516@lists.php.net to get a copy of this message | ||
Commit: 63a450281ae5d2e22cf5c28357f230f704905cb3
Author: Anatol Belski <ab@php.net> Tue, 21 Oct 2014 11:29:18 +0200
Parents: e011f0ca60a7d4d062b559dbbf7cfabef8f7a75b
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=63a450281ae5d2e22cf5c28357f230f704905cb3
Log:
reworked the current EOL stuff
Changed paths:
M config.m4
M config.w32
M phpdbg.c
M phpdbg.h
M phpdbg_prompt.c
Diff:
diff --git a/config.m4 b/config.m4
index 3bedc3c..3f24e30 100644
--- a/config.m4
+++ b/config.m4
@@ -33,7 +33,7 @@ if test "$BUILD_PHPDBG" == "" && test
"$PHP_PHPDBG" != "no"; then
fi
PHP_PHPDBG_CFLAGS="-D_GNU_SOURCE"
- PHP_PHPDBG_FILES="phpdbg.c phpdbg_parser.c phpdbg_lexer.c phpdbg_prompt.c phpdbg_help.c
phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c phpdbg_info.c
phpdbg_cmd.c phpdbg_set.c phpdbg_frame.c phpdbg_watch.c phpdbg_btree.c phpdbg_sigsafe.c
phpdbg_wait.c phpdbg_io.c"
+ PHP_PHPDBG_FILES="phpdbg.c phpdbg_parser.c phpdbg_lexer.c phpdbg_prompt.c phpdbg_help.c
phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c phpdbg_info.c
phpdbg_cmd.c phpdbg_set.c phpdbg_frame.c phpdbg_watch.c phpdbg_btree.c phpdbg_sigsafe.c
phpdbg_wait.c phpdbg_io.c phpdbg_eol.c"
if test "$PHP_READLINE" != "no" -o "$PHP_LIBEDIT" !=
"no"; then
PHPDBG_EXTRA_LIBS="$PHP_READLINE_LIBS"
diff --git a/config.w32 b/config.w32
index 40a5933..3f46393 100644
--- a/config.w32
+++ b/config.w32
@@ -5,7 +5,7 @@ PHPDBG_SOURCES='phpdbg.c phpdbg_prompt.c phpdbg_cmd.c phpdbg_info.c
phpdbg_help.
'phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c ' +
'phpdbg_set.c phpdbg_frame.c phpdbg_watch.c phpdbg_win.c phpdbg_btree.c '+
'phpdbg_parser.c phpdbg_lexer.c phpdbg_sigsafe.c phpdbg_wait.c phpdbg_io.c ' +
- 'phpdbg_sigio_win32.c';
+ 'phpdbg_sigio_win32.c phpdbg_eol.c';
PHPDBG_DLL='php' + PHP_VERSION + 'phpdbg.dll';
PHPDBG_EXE='phpdbg.exe';
diff --git a/phpdbg.c b/phpdbg.c
index 1133cd9..8686dcd 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -30,6 +30,7 @@
#include "phpdbg_set.h"
#include "phpdbg_io.h"
#include "zend_alloc.h"
+#include "phpdbg_eol.h"
/* {{{ remote console headers */
#ifndef _WIN32
@@ -51,24 +52,12 @@ static PHP_INI_MH(OnUpdateEol)
return FAILURE;
}
- if (0 == strcmp(new_value, "CRLF", 4) || 0 == strcmp(new_value, "crlf", 4)) {
- PHPDBG_G(eol) = "\r\n";
- } else if (0 == strcmp(new_value, "LF", 2) || 0 == strcmp(new_value, "lf", 4))
{
- PHPDBG_G(eol) = "\n";
- } else if (0 == strcmp(new_value, "CR", 2) || 0 == strcmp(new_value, "cr", 4))
{
- PHPDBG_G(eol) = "\r";
- } else if (0 == strcmp(new_value, "LFCR", 4) || 0 == strcmp(new_value, "lfcr",
4)) {
- PHPDBG_G(eol) = "\n\r";
- } else {
- return FAILURE;
- }
-
- return SUCCESS;
+ return phpdbg_update_eol_global(new_value TSRMLS_CC);
}
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("phpdbg.path", "", PHP_INI_SYSTEM | PHP_INI_PERDIR,
OnUpdateString, socket_path, zend_phpdbg_globals, phpdbg_globals)
- STD_PHP_INI_ENTRY("phpdbg.eol", "lf", PHP_INI_ALL, OnUpdateEol, socket_path,
zend_phpdbg_globals, phpdbg_globals)
+ STD_PHP_INI_ENTRY("phpdbg.eol", "2", PHP_INI_ALL, OnUpdateEol, socket_path,
zend_phpdbg_globals, phpdbg_globals)
PHP_INI_END()
static zend_bool phpdbg_booted = 0;
@@ -116,7 +105,7 @@ static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
memset(&pg->swd, 0, sizeof(struct win32_sigio_watcher_data));
#endif
- pg->eol = "\n";
+ pg->eol = PHPDBG_EOL_LF;
} /* }}} */
static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
diff --git a/phpdbg.h b/phpdbg.h
index 41124ea..b7346ab 100644
--- a/phpdbg.h
+++ b/phpdbg.h
@@ -286,7 +286,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
HANDLE sigio_watcher_thread; /* sigio watcher thread handle */
struct win32_sigio_watcher_data swd;
#endif
- char *eol;
+ int8_t eol;
ZEND_END_MODULE_GLOBALS(phpdbg) /* }}} */
#endif
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 387054f..20de859 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -83,7 +83,7 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
PHPDBG_COMMAND_D(quit, "exit phpdbg", 'q',
NULL, 0, PHPDBG_ASYNC_SAFE),
PHPDBG_COMMAND_D(wait, "wait for other process", 'W',
NULL, 0, 0),
PHPDBG_COMMAND_D(watch, "set watchpoint", 'w',
phpdbg_watch_commands, "|ss", 0),
- PHPDBG_COMMAND_D(eol, "set eol", 'E',
NULL, "|s", 0),
+ PHPDBG_COMMAND_D(eol, "set EOL", 'E',
NULL, "|s", 0),
PHPDBG_END_COMMAND
}; /* }}} */
@@ -1567,18 +1567,11 @@ next:
PHPDBG_COMMAND(eol) /* {{{ */
{
if (!param || param->type == EMPTY_PARAM) {
- //phpdbg_notice("eol", "variable=\"%.*s\"", "Set watchpoint on
%.*s", (int) param->len, param->str);
phpdbg_notice("eol", "argument required, supported crlf, lfcr, lf, cr",
"argument required, supported crlf, lfcr, lf, cr");
} else switch (param->type) {
case STR_PARAM:
- if (0 == strcmp(param->str, "CRLF", 4) || 0 == strcmp(param->str,
"crlf", 4)) {
- PHPDBG_G(eol) = "\r\n";
- } else if (0 == strcmp(param->str, "LF", 2) || 0 == strcmp(param->str,
"lf", 4)) {
- PHPDBG_G(eol) = "\n";
- } else if (0 == strcmp(param->str, "CR", 2) || 0 == strcmp(param->str,
"cr", 4)) {
- PHPDBG_G(eol) = "\r";
- } else if (0 == strcmp(param->str, "LFCR", 4) || 0 == strcmp(param->str,
"lfcr", 4)) {
- PHPDBG_G(eol) = "\n\r";
+ if (FAILURE == phpdbg_update_eol_global(param->str TSRMLS_CC)) {
+ phpdbg_notice("eol", "unknown EOL name '%s', give crlf, lfcr, lf,
cr", "unknown EOL name '%s', give crlf, lfcr, lf, cr", param->str);
}
break;