Merge branch 'jc/maint-github-actions-update'
[git.git] / compat / terminal.h
blob79ed00cf61ae1abfa2f433a174dc38ca5fc81706
1 #ifndef COMPAT_TERMINAL_H
2 #define COMPAT_TERMINAL_H
4 enum 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 };
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.
18 int save_term(enum save_term_flags flags);
19 /* Restore the terminal attributes that were saved with save_term() */
20 void restore_term(void);
22 char *git_terminal_prompt(const char *prompt, int echo);
24 /* Read a single keystroke, without echoing it to the terminal */
25 int read_key_without_echo(struct strbuf *buf);
27 #endif /* COMPAT_TERMINAL_H */