1 /* public definitions from tty.c */
2 
3 #ifndef _TTY_H_
4 #define _TTY_H_
5 
6 extern int tty_read_fd;
7 
8 extern char *tty_clreoln, *tty_clreoscr, *tty_begoln,
9             *tty_modebold, *tty_modeblink, *tty_modeuline,
10 	    *tty_modenorm, *tty_modenormbackup,
11             *tty_modeinv, *tty_modestandon, *tty_modestandoff;
12 
13 void tty_bootstrap	__P ((void));
14 void tty_start		__P ((void));
15 void tty_quit		__P ((void));
16 void tty_special_keys	__P ((void));
17 void tty_sig_winch_bottomhalf	__P ((void));
18 void tty_add_walk_binds		__P ((void));
19 void tty_add_initial_binds	__P ((void));
20 void tty_gotoxy			__P ((int col, int line));
21 void tty_gotoxy_opt		__P ((int fromcol, int fromline, int tocol, int toline));
22 
23 void input_delete_nofollow_chars	__P ((int n));
24 void input_overtype_follow		__P ((char c));
25 void input_insert_follow_chars		__P ((char *str, int n));
26 void input_moveto			__P ((int new_pos));
27 
28 #ifndef USE_LOCALE
29 
30 #define tty_puts(s) fputs((s), stdout)
31 /* printf("%s", (s)); would be as good */
32 
33 
34 #define tty_putc(c)             putc((unsigned char)(c), stdout)
35 #define tty_printf              printf
36 #define tty_read(buf, cnt)      read(tty_read_fd, (buf), (cnt))
37 #define tty_gets(s,size)        fgets((s), (size), stdin)
38 #define tty_flush()             fflush(stdout)
39 #define tty_raw_write(s,size)   do { tty_flush(); write(1, (s), (size)); } while (0)
40 
41 #else /* USE_LOCALE */
42 
43 #ifdef __GNUC__
44  #define PRINTF_FUNCTION(string, first) \
45 	__attribute__ ((format (printf, string, first)))
46 #else
47  #define PRINTF_FUNCTION(string, first)
48 #endif
49 
50 void tty_puts           __P ((const char *s));
51 void tty_putc           __P ((char c));
52 int  tty_printf         __P ((const char *format, ...)) PRINTF_FUNCTION(1, 2);
53 int  tty_read           __P ((char *buf, size_t count));
54 void tty_gets           __P ((char *s, int size));
55 void tty_flush          __P ((void));
56 void tty_raw_write      __P ((char *data, size_t len));
57 int  tty_has_chars      __P ((void));
58 
59 #endif /* USE_LOCALE */
60 
61 #endif /* _TTY_H_ */
62