Skip to content
Snippets Groups Projects
Commit 2b1a66ce authored by Glauber Costa's avatar Glauber Costa Committed by Pekka Enberg
Browse files

libc: implement some more terminal functions


Code comes from musl, but is moved to libc.cc to be together with the other functions
already present there.

Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 1bf43a19
No related branches found
No related tags found
No related merge requests found
...@@ -170,6 +170,39 @@ speed_t cfgetospeed(const termios *p) ...@@ -170,6 +170,39 @@ speed_t cfgetospeed(const termios *p)
return p->__c_ospeed; return p->__c_ospeed;
} }
int cfsetospeed(struct termios *tio, speed_t speed)
{
if (speed & ~CBAUD) {
errno = EINVAL;
return -1;
}
tio->c_cflag &= ~CBAUD;
tio->c_cflag |= speed;
return 0;
}
int cfsetispeed(struct termios *tio, speed_t speed)
{
return speed ? cfsetospeed(tio, speed) : 0;
}
weak_alias(cfsetospeed, cfsetspeed);
int tcsendbreak(int fd, int dur)
{
return ioctl(fd, TCSBRK, 0);
}
void cfmakeraw(struct termios *t)
{
t->c_iflag &= ~(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;
}
extern "C" { extern "C" {
const char *gnu_get_libc_version(void) const char *gnu_get_libc_version(void)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment