Git fork
1#ifndef COMPAT_TERMINAL_H
2#define COMPAT_TERMINAL_H
3
4enum save_term_flags {
5 /* Save input and output settings */
6 SAVE_TERM_DUPLEX = 1 << 0,
7 /* Save stdin rather than /dev/tty (fails if stdin is not a terminal) */
8 SAVE_TERM_STDIN = 1 << 1,
9};
10
11/*
12 * Save the terminal attributes so they can be restored later by a
13 * call to restore_term(). Note that every successful call to
14 * save_term() must be matched by a call to restore_term() even if the
15 * attributes have not been changed. Returns 0 on success, -1 on
16 * failure.
17 */
18int save_term(enum save_term_flags flags);
19/* Restore the terminal attributes that were saved with save_term() */
20void restore_term(void);
21
22char *git_terminal_prompt(const char *prompt, int echo);
23
24/* Read a single keystroke, without echoing it to the terminal */
25int read_key_without_echo(struct strbuf *buf);
26
27#endif /* COMPAT_TERMINAL_H */