75 lines
1.5 KiB
C
75 lines
1.5 KiB
C
|
|
#ifndef _LIBC_TERMIOS_H
|
||
|
|
#define _LIBC_TERMIOS_H
|
||
|
|
|
||
|
|
#include <sys/_structs.h>
|
||
|
|
#include <sys/cdefs.h>
|
||
|
|
#include <sys/types.h>
|
||
|
|
|
||
|
|
__BEGIN_DECLS
|
||
|
|
|
||
|
|
typedef unsigned char cc_t;
|
||
|
|
typedef unsigned int speed_t;
|
||
|
|
typedef unsigned int tcflag_t;
|
||
|
|
|
||
|
|
#define NCCS 32
|
||
|
|
struct termios {
|
||
|
|
tcflag_t c_iflag; /* input mode flags */
|
||
|
|
tcflag_t c_oflag; /* output mode flags */
|
||
|
|
tcflag_t c_cflag; /* control mode flags */
|
||
|
|
tcflag_t c_lflag; /* local mode flags */
|
||
|
|
cc_t c_cc[NCCS]; /* control characters */
|
||
|
|
};
|
||
|
|
typedef struct termios termios_t;
|
||
|
|
|
||
|
|
/* c_cc characters */
|
||
|
|
#define VINTR 0
|
||
|
|
#define VQUIT 1
|
||
|
|
#define VERASE 2
|
||
|
|
#define VKILL 3
|
||
|
|
#define VEOF 4
|
||
|
|
#define VTIME 5
|
||
|
|
#define VMIN 6
|
||
|
|
#define VSWTC 7
|
||
|
|
#define VSTART 8
|
||
|
|
#define VSTOP 9
|
||
|
|
#define VSUSP 10
|
||
|
|
#define VEOL 11
|
||
|
|
#define VREPRINT 12
|
||
|
|
#define VDISCARD 13
|
||
|
|
#define VWERASE 14
|
||
|
|
#define VLNEXT 15
|
||
|
|
#define VEOL2 16
|
||
|
|
|
||
|
|
/* c_lflag bits */
|
||
|
|
#define ISIG 0000001
|
||
|
|
#define ICANON 0000002
|
||
|
|
#define ECHO 0000010
|
||
|
|
#define ECHOE 0000020
|
||
|
|
#define ECHOK 0000040
|
||
|
|
#define ECHONL 0000100
|
||
|
|
#define NOFLSH 0000200
|
||
|
|
#define TOSTOP 0000400
|
||
|
|
#define IEXTEN 0100000
|
||
|
|
|
||
|
|
/* tcflow() and TCXONC use these */
|
||
|
|
#define TCOOFF 0
|
||
|
|
#define TCOON 1
|
||
|
|
#define TCIOFF 2
|
||
|
|
#define TCION 3
|
||
|
|
|
||
|
|
/* tcflush() and TCFLSH use these */
|
||
|
|
#define TCIFLUSH 0
|
||
|
|
#define TCOFLUSH 1
|
||
|
|
#define TCIOFLUSH 2
|
||
|
|
|
||
|
|
/* tcsetattr uses these */
|
||
|
|
#define TCSANOW 0
|
||
|
|
#define TCSADRAIN 1
|
||
|
|
#define TCSAFLUSH 2
|
||
|
|
|
||
|
|
int tcgetattr(int fd, termios_t* termios_p);
|
||
|
|
int tcsetattr(int fd, int optional_actions, const termios_t* termios_p);
|
||
|
|
|
||
|
|
__END_DECLS
|
||
|
|
|
||
|
|
#endif /* _LIBC_TERMIOS_H */
|