summaryrefslogtreecommitdiffstats
path: root/gnulib-local/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2006-12-12 14:16:34 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:14:27 +0200
commit7855a59545c6ff5e44c3124295b06170f53367e3 (patch)
treeb77e8e7a5983c7aaa7a23acf8e8d44590657b28b /gnulib-local/lib
parent28d18295d3351a024da8196da36ec14fedd6a786 (diff)
downloadexternal_gettext-7855a59545c6ff5e44c3124295b06170f53367e3.zip
external_gettext-7855a59545c6ff5e44c3124295b06170f53367e3.tar.gz
external_gettext-7855a59545c6ff5e44c3124295b06170f53367e3.tar.bz2
Portability to systems with GNU termcap.
Diffstat (limited to 'gnulib-local/lib')
-rw-r--r--gnulib-local/lib/term-ostream.oo.c10
-rw-r--r--gnulib-local/lib/termcap.h18
2 files changed, 28 insertions, 0 deletions
diff --git a/gnulib-local/lib/term-ostream.oo.c b/gnulib-local/lib/term-ostream.oo.c
index 64dbc8f..6d1d469 100644
--- a/gnulib-local/lib/term-ostream.oo.c
+++ b/gnulib-local/lib/term-ostream.oo.c
@@ -40,6 +40,16 @@
#define _(str) gettext (str)
+#if HAVE_TPARAM
+/* GNU termcap's tparam() function requires a buffer argument. Make it so
+ large that there is no risk that tparam() needs to call malloc(). */
+static char tparambuf[100];
+/* Define tparm in terms of tparam. In the scope of this file, it is called
+ with at most one argument after the string. */
+# define tparm(str, arg1) \
+ tparam (str, tparambuf, sizeof (tparambuf), arg1)
+#endif
+
#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
diff --git a/gnulib-local/lib/termcap.h b/gnulib-local/lib/termcap.h
index 4c7b17e..50386d2 100644
--- a/gnulib-local/lib/termcap.h
+++ b/gnulib-local/lib/termcap.h
@@ -43,10 +43,28 @@ extern int tgetflag (const char *id);
Also, if AREA != NULL, stores it at *AREA and advances *AREA. */
extern const char * tgetstr (const char *id, char **area);
+#if HAVE_TPARAM
+
+/* API provided by GNU termcap in <termcap.h>. */
+
+/* Instantiates a string capability with format strings.
+ BUF must be a buffer having room for BUFSIZE bytes.
+ The return value is either equal to BUF or freshly malloc()ed. */
+extern char * tparam (const char *str, void *buf, int bufsize, ...);
+
+#else
+
+/* API provided by
+ - GNU ncurses in <term.h>, <curses.h>, <ncurses.h>,
+ - OSF/1 curses in <term.h>, <curses.h>,
+ - Solaris, AIX, HP-UX, IRIX curses in <term.h>. */
+
/* Instantiates a string capability with format strings.
The return value is statically allocated and must not be freed. */
extern char * tparm (const char *str, ...);
+#endif
+
/* Retrieves a string that causes cursor positioning to (column, row).
This function is necessary because the string returned by tgetstr ("cm")
is in a special format. */