mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Add ONULBRK mapping flag
Add ONULBRK mapping to map nul (zero) to send break signal on output. This is useful if one needs to e.g. send the break signal to the tty device when connected via socket.
This commit is contained in:
parent
70913fe120
commit
4369d5b66f
2 changed files with 15 additions and 1 deletions
|
|
@ -182,6 +182,8 @@ Map DEL to BS on output
|
||||||
Map NL to CR-NL on output
|
Map NL to CR-NL on output
|
||||||
.IP "\fBOLTU"
|
.IP "\fBOLTU"
|
||||||
Map lowercase characters to uppercase on output
|
Map lowercase characters to uppercase on output
|
||||||
|
.IP "\fBONULBRK"
|
||||||
|
Map nul (zero) to send break signal on output
|
||||||
.IP "\fBMSB2LSB"
|
.IP "\fBMSB2LSB"
|
||||||
Map MSB bit order to LSB on output
|
Map MSB bit order to LSB on output
|
||||||
.P
|
.P
|
||||||
|
|
|
||||||
14
src/tty.c
14
src/tty.c
|
|
@ -153,6 +153,7 @@ static bool map_o_cr_nl = false;
|
||||||
static bool map_o_nl_crnl = false;
|
static bool map_o_nl_crnl = false;
|
||||||
static bool map_o_del_bs = false;
|
static bool map_o_del_bs = false;
|
||||||
static bool map_o_ltu = false;
|
static bool map_o_ltu = false;
|
||||||
|
static bool map_o_nulbrk = false;
|
||||||
static bool map_o_msblsb = false;
|
static bool map_o_msblsb = false;
|
||||||
static char hex_chars[2];
|
static char hex_chars[2];
|
||||||
static unsigned char hex_char_index = 0;
|
static unsigned char hex_char_index = 0;
|
||||||
|
|
@ -1115,6 +1116,10 @@ void tty_configure(void)
|
||||||
{
|
{
|
||||||
map_o_ltu = true;
|
map_o_ltu = true;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(token, "ONULBRK") == 0)
|
||||||
|
{
|
||||||
|
map_o_nulbrk = true;
|
||||||
|
}
|
||||||
else if (strcmp(token, "MSB2LSB") == 0)
|
else if (strcmp(token, "MSB2LSB") == 0)
|
||||||
{
|
{
|
||||||
map_o_msblsb = true;
|
map_o_msblsb = true;
|
||||||
|
|
@ -1289,7 +1294,14 @@ void forward_to_tty(int fd, char output_char)
|
||||||
{
|
{
|
||||||
/* Send output to tty device */
|
/* Send output to tty device */
|
||||||
optional_local_echo(output_char);
|
optional_local_echo(output_char);
|
||||||
status = tty_write(fd, &output_char, 1);
|
if ((output_char == 0) && (map_o_nulbrk))
|
||||||
|
{
|
||||||
|
status = tcsendbreak(fd, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = tty_write(fd, &output_char, 1);
|
||||||
|
}
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
{
|
{
|
||||||
tio_warning_printf("Could not write to tty device");
|
tio_warning_printf("Could not write to tty device");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue