1 /* Information about terminal capabilities.
2 Copyright (C) 2006 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2006.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* Including <curses.h> or <term.h> is dangerous, because it also declares
22 a lot of junk, such as variables PC, UP, and other. */
30 /* Gets the capability information for terminal type TYPE.
31 Returns 1 if successful, 0 if TYPE is unknown, -1 on other error. */
32 extern int tgetent (char *bp, const char *type);
34 /* Retrieves the value of a numerical capability.
35 Returns -1 if it is not available. */
36 extern int tgetnum (const char *id);
38 /* Retrieves the value of a boolean capability.
39 Returns 1 if it available, 0 otherwise. */
40 extern int tgetflag (const char *id);
42 /* Retrieves the value of a string capability.
43 Returns NULL if it is not available.
44 Also, if AREA != NULL, stores it at *AREA and advances *AREA. */
45 extern const char * tgetstr (const char *id, char **area);
51 /* Gets the capability information for terminal type TYPE and prepares FD.
52 Returns 0 if successful, -1 upon error. If ERRP is non-NULL, also returns
53 an error indicator in *ERRP; otherwise an error is signalled. */
54 extern int setupterm (const char *type, int fd, int *errp);
56 /* Retrieves the value of a numerical capability.
57 Returns -1 if it is not available, -2 if ID is invalid. */
58 extern int tigetnum (const char *id);
60 /* Retrieves the value of a boolean capability.
61 Returns 1 if it available, 0 if not available, -1 if ID is invalid. */
62 extern int tigetflag (const char *id);
64 /* Retrieves the value of a string capability.
65 Returns NULL if it is not available, (char *)(-1) if ID is invalid. */
66 extern const char * tigetstr (const char *id);
72 /* API provided by GNU termcap in <termcap.h>. */
74 /* Instantiates a string capability with format strings.
75 BUF must be a buffer having room for BUFSIZE bytes.
76 The return value is either equal to BUF or freshly malloc()ed. */
77 extern char * tparam (const char *str, void *buf, int bufsize, ...);
82 - GNU ncurses in <term.h>, <curses.h>, <ncurses.h>,
83 - OSF/1 curses in <term.h>, <curses.h>,
84 - Solaris, AIX, HP-UX, IRIX curses in <term.h>,
85 - gnulib's replacement. */
87 /* Instantiates a string capability with format strings.
88 The return value is statically allocated and must not be freed. */
89 extern char * tparm (const char *str, ...);
93 #if HAVE_TERMCAP || HAVE_TERMINFO
95 /* Retrieves a string that causes cursor positioning to (column, row).
96 This function is necessary because the string returned by tgetstr ("cm")
97 is in a special format. */
98 extern const char * tgoto (const char *cm, int column, int row);
102 /* Retrieves the value of a string capability.
103 OUTCHARFUN is called in turn for each 'char' of the result.
104 This function is necessary because string capabilities can contain
106 extern void tputs (const char *cp, int affcnt, int (*outcharfun) (int));
108 /* The ncurses functions for color handling (see ncurses/base/lib_color.c)
109 are overkill: Most terminal emulators support only a fixed, small number
116 #endif /* _TERMCAP_H */