From c88279f20426a4a239dced4189a88ac4191a15e3 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 4 May 2023 20:18:14 +0100 Subject: [PATCH] cfmakeraw implementation proposal --- src/header/termios/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/header/termios/mod.rs b/src/header/termios/mod.rs index bed8020379..4ffa7f1860 100644 --- a/src/header/termios/mod.rs +++ b/src/header/termios/mod.rs @@ -168,3 +168,14 @@ pub unsafe extern "C" fn tcflow(fd: c_int, action: c_int) -> c_int { // implementation-defined. we do the same. sys_ioctl::ioctl(fd, sys_ioctl::TCXONC, action as *mut _) } + +#[no_mangle] +pub unsafe extern "C" fn cfmakeraw(termios_p: *mut termios) { + (*termios_p).c_iflag &= !(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|IXON) as u32; + (*termios_p).c_oflag &= !OPOST as u32; + (*termios_p).c_lflag &= !(ECHO|ECHONL|ICANON|ISIG|IEXTEN) as u32; + (*termios_p).c_cflag &= !(CSIZE|PARENB) as u32; + (*termios_p).c_cflag |= CS8 as u32; + (*termios_p).c_cc[VMIN] = 1; + (*termios_p).c_cc[VTIME] = 0; +}