summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/tcsetattr.c
blob: 642588d47931c4e800be53665aee573712f161db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#define tcsetattr libc_tcsetattr
#include <termios.h>
#include <sys/ioctl.h>
#undef tcsetattr

#include <asm/errno.h>

extern int errno;

int tcsetattr(int fildes, int optional_actions, struct termios *termios_p)
{
  switch (optional_actions) {
  case TCSANOW:
    return ioctl(fildes, TCSETS, termios_p);
  case TCSADRAIN:
    return ioctl(fildes, TCSETSW, termios_p);
  case TCSAFLUSH:
    return ioctl(fildes, TCSETSF, termios_p);
  default:
    errno = EINVAL;
    return -1;
  }
}