stdio: puts() and vprintf()
[neatlibc.git] / termios.c
blobd2b64cfcf059f29f84704f74d63df92b96d15ed0
1 #include <errno.h>
2 #include <termios.h>
3 #include <sys/ioctl.h>
5 int tcgetattr(int fd, struct termios *term)
7 return ioctl(fd, TCGETS, term);
10 int tcsetattr(int fd, int actions, struct termios* term)
12 switch (actions) {
13 case TCSANOW:
14 return ioctl(fd, TCSETS , term);
15 case TCSADRAIN:
16 return ioctl(fd, TCSETSW, term);
17 case TCSAFLUSH:
18 return ioctl(fd, TCSETSF, term);
20 errno = EINVAL;
21 return -1;
24 void cfmakeraw(struct termios *t)
26 t->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP |
27 INLCR | IGNCR | ICRNL | IXON);
28 t->c_oflag &= ~OPOST;
29 t->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
30 t->c_cflag &= ~(CSIZE | PARENB);
31 t->c_cflag |= CS8;
32 t->c_cc[VMIN] = 1;
33 t->c_cc[VTIME] = 0;