#include "phpdbg_set.h"
#include "phpdbg_io.h"
#include "zend_alloc.h"
+#include "phpdbg_eol.h"
/* {{{ remote console headers */
#ifndef _WIN32
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;
memset(&pg->swd, 0, sizeof(struct win32_sigio_watcher_data));
#endif
- pg->eol = "\n";
+ pg->eol = PHPDBG_EOL_LF;
} /* }}} */
static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
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
}; /* }}} */
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;