diff options
Diffstat (limited to 'src/termios/tcsetattr.c')
| -rw-r--r-- | src/termios/tcsetattr.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/termios/tcsetattr.c b/src/termios/tcsetattr.c index b68652ad..a40439a2 100644 --- a/src/termios/tcsetattr.c +++ b/src/termios/tcsetattr.c @@ -1,9 +1,33 @@ #include <termios.h> +#include <errno.h> +#include "_termios.h" int tcsetattr(int fildes, int optional_actions, struct termios *termios_p) { - (void)optional_actions; (void)termios_p; - return fildes; + int ret = -1; + struct kernel_termios kt; + utok(kt, *termios_p); + + switch (optional_actions) { + case TCSANOW: + ret = ioctl(fildes, TCSETS, &kt); + break; + + case TCSADRAIN: + ret = ioctl(fildes, TCSETSW, &kt); + break; + + case TCSAFLUSH: + ret = ioctl(fildes, TCSETSF, &kt); + break; + + default: + errno = EINVAL; + return -1; + } + + ktou(*termios_p, kt); + return ret; } /* POSIX(1) |
