Welcome to mirror list, hosted at ThFree Co, Russian Federation.

termios.c « linux « sys « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 94567b16df3fed8a713a8c89cfa7eee787eca052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* libc/sys/linux/termios.c - Terminal control */

/* Written 2000 by Werner Almesberger */


#include <errno.h>
#include <sys/types.h>
#include <sys/termios.h>
#include <sys/ioctl.h>


int tcgetattr(int fd,struct termios *termios_p)
{
    return ioctl(fd,TCGETS,termios_p);
}


int tcsetattr(int fd,int optional_actions,const struct termios *termios_p)
{
    int cmd;

    switch (optional_actions) {
	case TCSANOW:
	    cmd = TCSETS;
	    break;
	case TCSADRAIN:
	    cmd = TCSETSW;
	    break;
	case TCSAFLUSH:
	    cmd = TCSETSF;
	    break;
	default:
	    errno = EINVAL;
	    return -1;
    }
    return ioctl(fd,cmd,termios_p);
}