summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/cfsetospeed.c
blob: d1aee35953c43cdf095908f8dfb81c6d66d96ad8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <termios.h>
#include <errno.h>
#include "dietfeatures.h"

int cfsetospeed(struct termios *termios_p, speed_t speed) {
  if ((speed & (speed_t)~CBAUD) != 0 && (speed < B57600 || speed > B460800)) {
    errno=EINVAL;
    return -1;
  }
  termios_p->c_cflag &= ~(CBAUD | CBAUDEX);
  termios_p->c_cflag |= speed;
  return 0;
}