summaryrefslogtreecommitdiff
path: root/lib/libc/termios/cfsetispeed.c
blob: 150973c1953b449c7c4c0e98014b14d8c2edb463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "asm-generic/termbits-common.h"
#include <asm-generic/termbits.h>
#include <errno.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;
}