Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libterminfo Correctly use ti_ instead of t_ for our exte...
details: https://anonhg.NetBSD.org/src/rev/1f7064e32618
branches: trunk
changeset: 770094:1f7064e32618
user: roy <roy%NetBSD.org@localhost>
date: Mon Oct 03 12:31:51 2011 +0000
description:
Correctly use ti_ instead of t_ for our extensions as per the man page.
Replace vtparm with tiparm.
tiparm is also non standard, but has been proposed at least.
diffstat:
lib/libterminfo/Makefile | 4 ++--
lib/libterminfo/term.h | 13 +++++++------
lib/libterminfo/termcap.c | 6 +++---
lib/libterminfo/terminfo.3 | 14 ++++++--------
lib/libterminfo/tparm.c | 38 ++++++++++++++------------------------
5 files changed, 32 insertions(+), 43 deletions(-)
diffs (224 lines):
diff -r d62b7c80acbb -r 1f7064e32618 lib/libterminfo/Makefile
--- a/lib/libterminfo/Makefile Mon Oct 03 11:31:56 2011 +0000
+++ b/lib/libterminfo/Makefile Mon Oct 03 12:31:51 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.14 2011/10/02 19:24:25 roy Exp $
+# $NetBSD: Makefile,v 1.15 2011/10/03 12:31:51 roy Exp $
USE_SHLIBDIR= yes
@@ -21,7 +21,7 @@
terminfo.3 putp.3 \
terminfo.3 ti_setupterm.3 terminfo.3 ti_getflag.3 \
terminfo.3 ti_getnum.3 terminfo.3 ti_getstr.3 \
- terminfo.3 t_parm.3 terminfo.3 t_vparm.3 \
+ terminfo.3 t_parm.3 terminfo.3 t_tiparm.3 \
terminfo.3 ti_puts.3 terminfo.3 ti_putp.3
# Build in termcap emulation
diff -r d62b7c80acbb -r 1f7064e32618 lib/libterminfo/term.h
--- a/lib/libterminfo/term.h Mon Oct 03 11:31:56 2011 +0000
+++ b/lib/libterminfo/term.h Mon Oct 03 12:31:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: term.h,v 1.8 2011/10/02 19:24:25 roy Exp $ */
+/* $NetBSD: term.h,v 1.9 2011/10/03 12:31:51 roy Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@@ -1484,7 +1484,7 @@
int ti_getflag(const TERMINAL *, const char *);
int ti_getnum(const TERMINAL *, const char *);
const char * ti_getstr(const TERMINAL *, const char *);
-char * t_parm(TERMINAL *, const char *,
+char * ti_parm(TERMINAL *, const char *,
long, long, long, long, long, long, long, long, long);
/* These functions do not use PC or speed, but the terminal */
@@ -1493,14 +1493,15 @@
int ti_putp(const TERMINAL *, const char *);
/* Using tparm can be kunkly, so provide a variadic function */
-char * vtparm(const char *, ...);
+/* This is not standard, but ncurses also provides this */
+char * tiparm(const char *, ...);
/* And a thread safe version */
-char * t_vparm(TERMINAL *, const char *, ...);
+char * ti_tiparm(TERMINAL *, const char *, ...);
/* Default to X/Open tparm, but allow it to be variadic also */
#ifdef TPARM_VARARGS
-# define tparm vtparm
-# define t_parm t_vtparm
+# define tparm tiparm
+# define ti_parm ti_tiparm
#endif
/* Convert a termcap string into a terminfo string.
diff -r d62b7c80acbb -r 1f7064e32618 lib/libterminfo/termcap.c
--- a/lib/libterminfo/termcap.c Mon Oct 03 11:31:56 2011 +0000
+++ b/lib/libterminfo/termcap.c Mon Oct 03 12:31:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: termcap.c,v 1.15 2011/09/16 18:51:44 christos Exp $ */
+/* $NetBSD: termcap.c,v 1.16 2011/10/03 12:31:51 roy Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: termcap.c,v 1.15 2011/09/16 18:51:44 christos Exp $");
+__RCSID("$NetBSD: termcap.c,v 1.16 2011/10/03 12:31:51 roy Exp $");
#include <assert.h>
#include <ctype.h>
@@ -176,7 +176,7 @@
tgoto(const char *cm, int destcol, int destline)
{
_DIAGASSERT(cm != NULL);
- return vtparm(cm, destline, destcol);
+ return tiparm(cm, destline, destcol);
}
static const char *
diff -r d62b7c80acbb -r 1f7064e32618 lib/libterminfo/terminfo.3
--- a/lib/libterminfo/terminfo.3 Mon Oct 03 11:31:56 2011 +0000
+++ b/lib/libterminfo/terminfo.3 Mon Oct 03 12:31:51 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: terminfo.3,v 1.5 2011/10/02 19:24:25 roy Exp $
+.\" $NetBSD: terminfo.3,v 1.6 2011/10/03 12:31:51 roy Exp $
.\"
.\" Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd October 2, 2011
+.Dd October 3, 2011
.Dt TERMINFO 3
.Os
.Sh NAME
@@ -78,11 +78,9 @@
.Ft const char *
.Fn ti_getstr "const TERMINAL *" "const char *id"
.Ft char *
-.Fn t_parm "const TERMINAL *" "const char *cm" "long p1" "long p2" "long p3" "long p4" "long p5" "long p6" "long p7" "long p8" "long p9"
+.Fn tiparm "const char *cm" "..."
.Ft char *
-.Fn t_parm "const char *cm" "..."
-.Ft char *
-.Fn t_vparm "TERMINAL *" "const char *cm" "..."
+.Fn ti_tiparm "TERMINAL *" "const char *cm" "..."
.Ft int
.Fn ti_puts "const TERMINAL *term" "const char *str" "int affcnt" "int (*outc)(int, void *)"
.Ft int
@@ -206,9 +204,9 @@
always goes to stdout.
.Ss NetBSD Extensions To Terminfo
The
-.Fn vtparm
+.Fn tiparm
function allows variadic parameters instead of 9 fixed longs.
-Numeric parameters must be longs.
+Numeric parameters must be integers (int) instead of longs.
String parameters can be used even if the platform cannot fit a
.Vt char *
into a
diff -r d62b7c80acbb -r 1f7064e32618 lib/libterminfo/tparm.c
--- a/lib/libterminfo/tparm.c Mon Oct 03 11:31:56 2011 +0000
+++ b/lib/libterminfo/tparm.c Mon Oct 03 12:31:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tparm.c,v 1.5 2011/03/10 13:39:26 roy Exp $ */
+/* $NetBSD: tparm.c,v 1.6 2011/10/03 12:31:51 roy Exp $ */
/*
* Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: tparm.c,v 1.5 2011/03/10 13:39:26 roy Exp $");
+__RCSID("$NetBSD: tparm.c,v 1.6 2011/10/03 12:31:51 roy Exp $");
#include <assert.h>
#include <ctype.h>
@@ -129,7 +129,7 @@
}
static char *
-_ti_vtparm(TERMINAL *term, const char *str, va_list parms)
+_ti_tiparm(TERMINAL *term, const char *str, va_list parms)
{
const char *sp;
char c, fmt[64], *fp, *ostr;
@@ -208,7 +208,7 @@
memset(¶ms, 0, sizeof(params));
for (l = 0; l < max; l++) {
if (piss[l] == 0)
- params[l].num = va_arg(parms, long);
+ params[l].num = va_arg(parms, int);
else
params[l].string = va_arg(parms, char *);
}
@@ -495,7 +495,7 @@
}
char *
-t_vparm(TERMINAL *term, const char *str, ...)
+ti_tiparm(TERMINAL *term, const char *str, ...)
{
va_list va;
char *ret;
@@ -504,13 +504,13 @@
_DIAGASSERT(str != NULL);
va_start(va, str);
- ret = _ti_vtparm(term, str, va);
+ ret = _ti_tiparm(term, str, va);
va_end(va);
return ret;
}
char *
-vtparm(const char *str, ...)
+tiparm(const char *str, ...)
{
va_list va;
char *ret;
@@ -518,28 +518,18 @@
_DIAGASSERT(str != NULL);
va_start(va, str);
- ret = _ti_vtparm(NULL, str, va);
+ ret = _ti_tiparm(NULL, str, va);
va_end(va);
return ret;
}
char *
-t_parm(TERMINAL *term, const char *str,
- long p1, long p2, long p3, long p4, long p5,
- long p6, long p7, long p8, long p9)
+tparm(const char *str,
+ long lp1, long lp2, long lp3, long lp4, long lp5,
+ long lp6, long lp7, long lp8, long lp9)
{
+ int p1 = lp1, p2 = lp2, p3 = lp3, p4 = lp4, p5 = lp5;
+ int p6 = lp6, p7 = lp7, p8 = lp8, p9 = lp9;
- _DIAGASSERT(term != NULL);
- _DIAGASSERT(str != NULL);
- return t_vparm(term, str, p1, p2, p3, p4, p5, p6, p7, p8, p9);
+ return tiparm(NULL, str, p1, p2, p3, p4, p5, p6, p7, p8, p9);
}
-
-char *
-tparm(const char *str,
- long p1, long p2, long p3, long p4, long p5,
- long p6, long p7, long p8, long p9)
-{
-
- _DIAGASSERT(str != NULL);
- return t_vparm(NULL, str, p1, p2, p3, p4, p5, p6, p7, p8, p9);
-}
Home |
Main Index |
Thread Index |
Old Index