mirror of
https://github.com/php/php-src.git
synced 2026-03-29 11:42:17 +02:00
prepare setting EOL with command or INI
This commit is contained in:
22
phpdbg.c
22
phpdbg.c
@@ -45,8 +45,30 @@
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(phpdbg);
|
||||
|
||||
static PHP_INI_MH(OnUpdateEol)
|
||||
{
|
||||
if (!new_value) {
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
PHP_INI_END()
|
||||
|
||||
static zend_bool phpdbg_booted = 0;
|
||||
|
||||
@@ -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
|
||||
}; /* }}} */
|
||||
|
||||
@@ -1563,3 +1563,26 @@ next:
|
||||
zend_bailout();
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
break;
|
||||
|
||||
phpdbg_default_switch_case();
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ PHPDBG_COMMAND(export);
|
||||
PHPDBG_COMMAND(register);
|
||||
PHPDBG_COMMAND(quit);
|
||||
PHPDBG_COMMAND(watch);
|
||||
PHPDBG_COMMAND(eol);
|
||||
PHPDBG_COMMAND(wait); /* }}} */
|
||||
|
||||
/* {{{ prompt commands */
|
||||
|
||||
Reference in New Issue
Block a user