1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:27:45 +00:00

LibC: Add 'cfmakeraw()'

This commit is contained in:
AnotherTest 2021-02-13 10:46:09 +03:30 committed by Andreas Kling
parent 0c07c005b5
commit 9e2c37a8b2
2 changed files with 13 additions and 0 deletions

View file

@ -145,4 +145,16 @@ int cfsetospeed(struct termios* tp, speed_t speed)
} }
__RETURN_WITH_ERRNO(ospeed, 0, -1); __RETURN_WITH_ERRNO(ospeed, 0, -1);
} }
void cfmakeraw(struct termios* tp)
{
if (!tp)
return;
auto& termios = *tp;
termios.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
termios.c_lflag &= ~OPOST;
termios.c_cflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
termios.c_cflag |= CS8;
}
} }

View file

@ -56,6 +56,7 @@ speed_t cfgetispeed(const struct termios*);
speed_t cfgetospeed(const struct termios*); speed_t cfgetospeed(const struct termios*);
int cfsetispeed(struct termios*, speed_t); int cfsetispeed(struct termios*, speed_t);
int cfsetospeed(struct termios*, speed_t); int cfsetospeed(struct termios*, speed_t);
void cfmakeraw(struct termios*);
/* c_cc characters */ /* c_cc characters */
#define VINTR 0 #define VINTR 0