summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-06-24 15:25:14 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-06-24 15:25:14 -0700
commitce014dced52afc366fcbe08c60b8f725812f1bc2 (patch)
tree87d8408a3fe9ff72d2bef92010ea26f8891f163c
parent5c715e07403fe9dae10d0ce531bc0b348e17cacf (diff)
downloadsyslinux-ce014dced52afc366fcbe08c60b8f725812f1bc2.tar.gz
Default to \n -> \r\n in ANSI and xserial
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.
-rw-r--r--com32/lib/sys/ansi.c2
-rw-r--r--com32/lib/sys/stdcon_write.c2
-rw-r--r--com32/lib/sys/xserial_write.c5
-rw-r--r--com32/menu/vesamenu.c4
4 files changed, 8 insertions, 5 deletions
diff --git a/com32/lib/sys/ansi.c b/com32/lib/sys/ansi.c
index 5af4a760..29a069f0 100644
--- a/com32/lib/sys/ansi.c
+++ b/com32/lib/sys/ansi.c
@@ -46,7 +46,7 @@ static const struct term_state default_state =
.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,
diff --git a/com32/lib/sys/stdcon_write.c b/com32/lib/sys/stdcon_write.c
index ef51b76f..458d2c26 100644
--- a/com32/lib/sys/stdcon_write.c
+++ b/com32/lib/sys/stdcon_write.c
@@ -28,7 +28,7 @@
/*
* stdcon_write.c
*
- * Writing to the console
+ * Writing to the console; \n -> \r\n conversion.
*/
#include <errno.h>
diff --git a/com32/lib/sys/xserial_write.c b/com32/lib/sys/xserial_write.c
index ef540d48..6d0d0f79 100644
--- a/com32/lib/sys/xserial_write.c
+++ b/com32/lib/sys/xserial_write.c
@@ -28,7 +28,7 @@
/*
* 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.
*/
@@ -73,6 +73,9 @@ ssize_t __xserial_write(struct file_info *fp, const void *buf, size_t count)
if (ch >= 1 && ch <= 5) {
state = st_tbl;
ndigits = ch;
+ } else if (ch == '\n') {
+ emit('\r');
+ emit('\n');
} else {
emit(ch);
}
diff --git a/com32/menu/vesamenu.c b/com32/menu/vesamenu.c
index cebbb344..094b8f65 100644
--- a/com32/menu/vesamenu.c
+++ b/com32/menu/vesamenu.c
@@ -27,13 +27,13 @@
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)