OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [sys/] [linux/] [termios.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
/* libc/sys/linux/termios.c - Terminal control */
2
 
3
/* Written 2000 by Werner Almesberger */
4
 
5
 
6
#include <errno.h>
7
#include <sys/types.h>
8
#include <sys/termios.h>
9
#include <sys/ioctl.h>
10
 
11
 
12
int tcgetattr(int fd,struct termios *termios_p)
13
{
14
    return ioctl(fd,TCGETS,termios_p);
15
}
16
 
17
 
18
int tcsetattr(int fd,int optional_actions,const struct termios *termios_p)
19
{
20
    int cmd;
21
 
22
    switch (optional_actions) {
23
        case TCSANOW:
24
            cmd = TCSETS;
25
            break;
26
        case TCSADRAIN:
27
            cmd = TCSETSW;
28
            break;
29
        case TCSAFLUSH:
30
            cmd = TCSETSF;
31
            break;
32
        default:
33
            errno = EINVAL;
34
            return -1;
35
    }
36
    return ioctl(fd,cmd,termios_p);
37
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.