Module Name: src
Committed By: roy
Date: Sun Oct 2 19:24:25 UTC 2011
Modified Files:
src/lib/libterminfo: Makefile curterm.c term.h terminfo.3
Log Message:
Add termname(3) as defined by POSIX.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libterminfo/Makefile
cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/curterm.c \
src/lib/libterminfo/terminfo.3
cvs rdiff -u -r1.7 -r1.8 src/lib/libterminfo/term.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libterminfo/Makefile
diff -u src/lib/libterminfo/Makefile:1.13 src/lib/libterminfo/Makefile:1.14
--- src/lib/libterminfo/Makefile:1.13 Tue Aug 16 10:36:30 2011
+++ src/lib/libterminfo/Makefile Sun Oct 2 19:24:25 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.13 2011/08/16 10:36:30 christos Exp $
+# $NetBSD: Makefile,v 1.14 2011/10/02 19:24:25 roy Exp $
USE_SHLIBDIR= yes
@@ -15,6 +15,7 @@ INCSDIR= /usr/include
MAN= terminfo.3 terminfo.5
MLINKS= terminfo.3 setupterm.3 \
terminfo.3 set_curterm.3 terminfo.3 del_curterm.3 \
+ terminfo.3 termname.3 \
terminfo.3 tigetnum.3 terminfo.3 tigetflag.3 \
terminfo.3 tigetstr.3 terminfo.3 tparm.3 terminfo.3 tputs.3 \
terminfo.3 putp.3 \
Index: src/lib/libterminfo/curterm.c
diff -u src/lib/libterminfo/curterm.c:1.4 src/lib/libterminfo/curterm.c:1.5
--- src/lib/libterminfo/curterm.c:1.4 Mon Feb 22 23:05:39 2010
+++ src/lib/libterminfo/curterm.c Sun Oct 2 19:24:25 2011
@@ -1,7 +1,7 @@
-/* $NetBSD: curterm.c,v 1.4 2010/02/22 23:05:39 roy Exp $ */
+/* $NetBSD: curterm.c,v 1.5 2011/10/02 19:24:25 roy Exp $ */
/*
- * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Roy Marples.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: curterm.c,v 1.4 2010/02/22 23:05:39 roy Exp $");
+__RCSID("$NetBSD: curterm.c,v 1.5 2011/10/02 19:24:25 roy Exp $");
#include <assert.h>
#include <stdlib.h>
@@ -90,6 +90,15 @@ int
del_curterm(TERMINAL *oterm)
{
+ _DIAGASSERT(oterm != NULL);
_ti_freeterm(oterm);
return 0;
}
+
+char *
+termname(void)
+{
+
+ _DIAGASSERT(cur_term != NULL);
+ return __UNCONST(cur_term->name);
+}
Index: src/lib/libterminfo/terminfo.3
diff -u src/lib/libterminfo/terminfo.3:1.4 src/lib/libterminfo/terminfo.3:1.5
--- src/lib/libterminfo/terminfo.3:1.4 Thu Feb 4 09:12:56 2010
+++ src/lib/libterminfo/terminfo.3 Sun Oct 2 19:24:25 2011
@@ -1,6 +1,6 @@
-.\" $NetBSD: terminfo.3,v 1.4 2010/02/04 09:12:56 wiz Exp $
+.\" $NetBSD: terminfo.3,v 1.5 2011/10/02 19:24:25 roy Exp $
.\"
-.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,13 +27,14 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd December 7, 2009
+.Dd October 2, 2011
.Dt TERMINFO 3
.Os
.Sh NAME
.Nm setupterm ,
.Nm set_curterm ,
.Nm del_curterm ,
+.Nm termname ,
.Nm tigetflag ,
.Nm tigetnum ,
.Nm tigetstr ,
@@ -54,6 +55,8 @@
.Fn set_curterm "TERMINAL *term"
.Ft int
.Fn del_curterm "TERMINAL *term"
+.Ft char *
+.Fn termname "void"
.Ft int
.Fn tigetnum "const char *id"
.Ft int
@@ -144,6 +147,11 @@ function frees space pointed to by
.Va oterm .
.Pp
The
+.Fn termname
+function returns the name of
+.Va cur_term .
+.Pp
+The
.Fn tigetflag
function gets the boolean value of capability
.Va id ,
Index: src/lib/libterminfo/term.h
diff -u src/lib/libterminfo/term.h:1.7 src/lib/libterminfo/term.h:1.8
--- src/lib/libterminfo/term.h:1.7 Mon Apr 11 21:13:09 2011
+++ src/lib/libterminfo/term.h Sun Oct 2 19:24:25 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: term.h,v 1.7 2011/04/11 21:13:09 roy Exp $ */
+/* $NetBSD: term.h,v 1.8 2011/10/02 19:24:25 roy Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@@ -1468,6 +1468,7 @@ extern TERMINAL *cur_term;
int setupterm(const char *, int, int *);
TERMINAL * set_curterm(TERMINAL *);
int del_curterm(TERMINAL *);
+char * termname(void);
/* information functions */
int tigetflag(const char *);