• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/gettext-0.17/gnulib-local/lib/
1/* Information about terminal capabilities.
2   Copyright (C) 2006 Free Software Foundation, Inc.
3   Written by Bruno Haible <bruno@clisp.org>, 2006.
4
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.
9
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.
14
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/>.  */
17
18#ifndef _TERMCAP_H
19#define _TERMCAP_H
20
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.  */
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#if HAVE_TERMCAP
29
30/* Gets the capability information for terminal type TYPE.
31   Returns 1 if successful, 0 if TYPE is unknown, -1 on other error.  */
32extern int tgetent (char *bp, const char *type);
33
34/* Retrieves the value of a numerical capability.
35   Returns -1 if it is not available.  */
36extern int tgetnum (const char *id);
37
38/* Retrieves the value of a boolean capability.
39   Returns 1 if it available, 0 otherwise.  */
40extern int tgetflag (const char *id);
41
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.  */
45extern const char * tgetstr (const char *id, char **area);
46
47#endif
48
49#if HAVE_TERMINFO
50
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.  */
54extern int setupterm (const char *type, int fd, int *errp);
55
56/* Retrieves the value of a numerical capability.
57   Returns -1 if it is not available, -2 if ID is invalid.  */
58extern int tigetnum (const char *id);
59
60/* Retrieves the value of a boolean capability.
61   Returns 1 if it available, 0 if not available, -1 if ID is invalid.  */
62extern int tigetflag (const char *id);
63
64/* Retrieves the value of a string capability.
65   Returns NULL if it is not available, (char *)(-1) if ID is invalid.  */
66extern const char * tigetstr (const char *id);
67
68#endif
69
70#if HAVE_TPARAM
71
72/* API provided by GNU termcap in <termcap.h>.  */
73
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.  */
77extern char * tparam (const char *str, void *buf, int bufsize, ...);
78
79#else
80
81/* API provided by
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.  */
86
87/* Instantiates a string capability with format strings.
88   The return value is statically allocated and must not be freed.  */
89extern char * tparm (const char *str, ...);
90
91#endif
92
93#if HAVE_TERMCAP || HAVE_TERMINFO
94
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.  */
98extern const char * tgoto (const char *cm, int column, int row);
99
100#endif
101
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
105   padding commands.  */
106extern void tputs (const char *cp, int affcnt, int (*outcharfun) (int));
107
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
110   of colors.  */
111
112#ifdef __cplusplus
113}
114#endif
115
116#endif /* _TERMCAP_H */
117