Default to \n -> \r\n conversion in the ANSI and xserial modules,
rather than relying on escape codes to make that behave. This
effectively means that as far as the serial port is concerned, this
behavior cannot be turned off (with less than having the xserial state
machine interpret this sequence) and the escape code *should not* be
used.
That is fine for our applications, though.
.reverse = 0,
.fg = 7,
.bg = 0,
- .autocr = 0,
+ .autocr = 1, /* Mimic \n -> \r\n conversion by default */
.saved_xy = { 0, 0 },
.cursor = 1,
.state = st_init,
/*
* stdcon_write.c
*
- * Writing to the console
+ * Writing to the console; \n -> \r\n conversion.
*/
#include <errno.h>
/*
* xserial_write.c
*
- * Raw writing to the serial port; no \n -> \r\n translation, but
+ * Raw writing to the serial port; \n -> \r\n translation, and
* convert \1# sequences.
*/
if (ch >= 1 && ch <= 5) {
state = st_tbl;
ndigits = ch;
+ } else if (ch == '\n') {
+ emit('\r');
+ emit('\n');
} else {
emit(ch);
}
void console_prepare(void)
{
- fputs("\033[0m\033[20h\033[25l", stdout);
+ fputs("\033[0m\033[25l", stdout);
}
void console_cleanup(void)
{
/* For the serial console, be nice and clean up */
- fputs("\033[0m\033[20l", stdout);
+ fputs("\033[0m", stdout);
}
int draw_background(const char *what)