Usermode - POSIX and C conformance changes
[tpg/acess2.git] / Usermode / Libraries / libposix.so_src / termios.c
1 /*
2  * Acess2 POSIX Emulation
3  * - By John Hodge (thePowersGang)
4  *
5  * termios.c
6  * - Terminal Control
7  */
8 #include <termios.h>
9 #include <errno.h>
10 #include <string.h>
11
12 // === CODE ===
13 int tcgetattr(int fd, struct termios *termios_p)
14 {
15         if( fd == -1 ) {
16                 errno = EBADF;
17                 return -1;
18         }
19         // Double-check `fd` describes a terminal
20         
21         // Fill defaults
22         memset(termios_p, 0, sizeof(struct termios));
23
24         // Query kernel for other params        
25
26         return 0;
27 }
28
29 int tcsetattr(int fd, int optional_actions, const struct termios *termios_p)
30 {
31         if( fd == -1 ) {
32                 errno = EBADF;
33                 return -1;
34         }
35
36         if( !termios_p || (optional_actions & ~(7)) ) {
37                 errno = EINVAL;
38                 return -1;
39         }
40         
41         return 0;
42 }
43

UCC git Repository :: git.ucc.asn.au