aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib
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 /com32/lib
parent5c715e07403fe9dae10d0ce531bc0b348e17cacf (diff)
downloadsyslinux-elf-ce014dced52afc366fcbe08c60b8f725812f1bc2.tar.gz
syslinux-elf-ce014dced52afc366fcbe08c60b8f725812f1bc2.tar.xz
syslinux-elf-ce014dced52afc366fcbe08c60b8f725812f1bc2.zip
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.
Diffstat (limited to 'com32/lib')
-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
3 files changed, 6 insertions, 3 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);
}