Add cfmakeraw() emulation

This commit is contained in:
Lassi Kortela 2019-10-14 02:51:04 +03:00
parent a174bba817
commit a5735b8967
2 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,5 @@
#include <sys/termios.h>
#include <math.h>
#include <setjmp.h>
#include <stdarg.h>
@ -14,3 +16,15 @@ char *get_exename(char *buf, size_t size)
(void)size;
return NULL;
}
void cfmakeraw(struct termios *t)
{
t->c_iflag &= ~(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
IGNCR | ICRNL | IXON);
t->c_oflag &= ~OPOST;
t->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
t->c_cflag &= ~(CSIZE | PARENB);
t->c_cflag |= CS8;
t->c_cc[VMIN] = 1;
t->c_cc[VTIME] = 0;
}

View File

@ -218,6 +218,8 @@ static void relocate_dir(value_t oldv, value_t newv)
static struct termios term_mode_orig;
static struct termios term_mode_raw;
void cfmakeraw(struct termios *t);
static void term_mode_init(void)
{
static int done;