60 lines
1.6 KiB
C
60 lines
1.6 KiB
C
/*
|
|
* <termios.h> for the MontaukOS git port.
|
|
*
|
|
* compat/terminal.c uses tcgetattr/tcsetattr to turn off echo while reading a
|
|
* passphrase, and to put the terminal in raw mode for single-keystroke reads
|
|
* ("git add -p"). The MontaukOS terminal has no line discipline to configure:
|
|
* the libc reads stdin through SYS_GETCHAR and does its own echoing.
|
|
*
|
|
* These calls therefore succeed and do nothing rather than failing, because
|
|
* git treats a tcgetattr() failure as "not a terminal" and a tcsetattr()
|
|
* failure as fatal in some paths. The visible consequence is that a typed
|
|
* passphrase is echoed -- there is no credential helper in this port, so
|
|
* nothing prompts for one yet.
|
|
*
|
|
* Implementation in montauk-compat.c.
|
|
*/
|
|
#ifndef _MONTAUK_GIT_TERMIOS_H_
|
|
#define _MONTAUK_GIT_TERMIOS_H_
|
|
|
|
#include <sys/types.h>
|
|
|
|
typedef unsigned int tcflag_t;
|
|
typedef unsigned char cc_t;
|
|
typedef unsigned int speed_t;
|
|
|
|
#define NCCS 32
|
|
|
|
struct termios {
|
|
tcflag_t c_iflag;
|
|
tcflag_t c_oflag;
|
|
tcflag_t c_cflag;
|
|
tcflag_t c_lflag;
|
|
cc_t c_line;
|
|
cc_t c_cc[NCCS];
|
|
speed_t c_ispeed;
|
|
speed_t c_ospeed;
|
|
};
|
|
|
|
/* Linux values, so code that masks bits it never applies still builds. */
|
|
#define ECHO 0000010
|
|
#define ECHONL 0000100
|
|
#define ICANON 0000002
|
|
#define ISIG 0000001
|
|
#define IEXTEN 0100000
|
|
#define IXON 0002000
|
|
#define ICRNL 0000400
|
|
#define OPOST 0000001
|
|
|
|
#define VMIN 6
|
|
#define VTIME 5
|
|
|
|
#define TCSANOW 0
|
|
#define TCSADRAIN 1
|
|
#define TCSAFLUSH 2
|
|
|
|
int tcgetattr(int fd, struct termios *t);
|
|
int tcsetattr(int fd, int actions, const struct termios *t);
|
|
|
|
#endif /* _MONTAUK_GIT_TERMIOS_H_ */
|