Author: pulkomandy Date: 2011-10-16 18:44:17 +0200 (Sun, 16 Oct 2011) New Revision: 42865 Changeset: https://dev.haiku-os.org/changeset/42865 Modified: haiku/trunk/headers/posix/termios.h haiku/trunk/src/system/libroot/posix/termios.c Log: Add cfmakeraw. Like cf{get/set}{i/o}speed, it iisn't POSIx standard but is used often enough and simple enough to write that we should allow it. Modified: haiku/trunk/headers/posix/termios.h =================================================================== --- haiku/trunk/headers/posix/termios.h 2011-10-16 16:02:34 UTC (rev 42864) +++ haiku/trunk/headers/posix/termios.h 2011-10-16 16:44:17 UTC (rev 42865) @@ -223,6 +223,7 @@ extern speed_t cfgetospeed(const struct termios *termios); extern int cfsetispeed(struct termios *termios, speed_t speed); extern int cfsetospeed(struct termios *termios, speed_t speed); +extern void cfmakeraw(struct termios *termios); extern int tcgetattr(int fd, struct termios *termios); extern int tcsetattr(int fd, int option, const struct termios *termios); extern int tcsendbreak(int fd, int duration); Modified: haiku/trunk/src/system/libroot/posix/termios.c =================================================================== --- haiku/trunk/src/system/libroot/posix/termios.c 2011-10-16 16:02:34 UTC (rev 42864) +++ haiku/trunk/src/system/libroot/posix/termios.c 2011-10-16 16:44:17 UTC (rev 42865) @@ -146,3 +146,15 @@ termios->c_cflag |= speed; return 0; } + + +void +cfmakeraw(struct termios *termios) +{ + termios->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR + | ICRNL | IXON); + termios->c_oflag &= ~OPOST; + termios->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + termios->c_cflag &= ~(CSIZE | PARENB); + termios->c_cflag |= CS8; +}