summaryrefslogtreecommitdiff
path: root/lib/libc/termios/cfsetispeed.c
blob: b990d59891fb24764cff3653e36070fb8bc3138a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <errno.h>
#include <asm-generic/termbits.h>

int cfsetispeed(struct termios *termios_p, speed_t speed)
{
	if (speed & ~CBAUD) {
		errno = EINVAL;
		return -1;
	}

	termios_p->c_cflag &= ~CIBAUD;
	termios_p->c_cflag |= speed * (CIBAUD / CBAUD);
	return 0;
}