mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Merge pull request #72 from hzeller/cr-nl
Map CR->NL locally on output instead of using tio.c_oflag |= OCRNL.
This commit is contained in:
commit
64f9f3a248
1 changed files with 4 additions and 1 deletions
|
|
@ -55,6 +55,7 @@ static bool standard_baudrate = true;
|
||||||
static void (*print)(char c);
|
static void (*print)(char c);
|
||||||
static int fd;
|
static int fd;
|
||||||
static bool map_inlcrnl = false;
|
static bool map_inlcrnl = false;
|
||||||
|
static bool map_ocrnl = false;
|
||||||
static bool map_onlcrnl = false;
|
static bool map_onlcrnl = false;
|
||||||
static bool map_odelbs = false;
|
static bool map_odelbs = false;
|
||||||
|
|
||||||
|
|
@ -415,7 +416,7 @@ void tty_configure(void)
|
||||||
else if (strcmp(token,"ICRNL") == 0)
|
else if (strcmp(token,"ICRNL") == 0)
|
||||||
tio.c_iflag |= ICRNL;
|
tio.c_iflag |= ICRNL;
|
||||||
else if (strcmp(token,"OCRNL") == 0)
|
else if (strcmp(token,"OCRNL") == 0)
|
||||||
tio.c_oflag |= OCRNL;
|
map_ocrnl = true;
|
||||||
else if (strcmp(token,"ODELBS") == 0)
|
else if (strcmp(token,"ODELBS") == 0)
|
||||||
map_odelbs = true;
|
map_odelbs = true;
|
||||||
else if (strcmp(token,"INLCRNL") == 0)
|
else if (strcmp(token,"INLCRNL") == 0)
|
||||||
|
|
@ -652,6 +653,8 @@ int tty_connect(void)
|
||||||
/* Map output character */
|
/* Map output character */
|
||||||
if ((output_char == 127) && (map_odelbs))
|
if ((output_char == 127) && (map_odelbs))
|
||||||
output_char = '\b';
|
output_char = '\b';
|
||||||
|
if ((output_char == '\r') && (map_ocrnl))
|
||||||
|
output_char = '\n';
|
||||||
|
|
||||||
/* Map newline character */
|
/* Map newline character */
|
||||||
if ((output_char == '\n') && (map_onlcrnl)) {
|
if ((output_char == '\n') && (map_onlcrnl)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue