Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libterminfo Add termname(3) as defined by POSIX.



details:   https://anonhg.NetBSD.org/src/rev/ab1b4ab844dc
branches:  trunk
changeset: 770073:ab1b4ab844dc
user:      roy <roy%NetBSD.org@localhost>
date:      Sun Oct 02 19:24:25 2011 +0000

description:
Add termname(3) as defined by POSIX.

diffstat:

 lib/libterminfo/Makefile   |   3 ++-
 lib/libterminfo/curterm.c  |  15 ++++++++++++---
 lib/libterminfo/term.h     |   3 ++-
 lib/libterminfo/terminfo.3 |  14 +++++++++++---
 4 files changed, 27 insertions(+), 8 deletions(-)

diffs (121 lines):

diff -r 8f61792eacd4 -r ab1b4ab844dc lib/libterminfo/Makefile
--- a/lib/libterminfo/Makefile  Sun Oct 02 19:15:39 2011 +0000
+++ b/lib/libterminfo/Makefile  Sun Oct 02 19:24:25 2011 +0000
@@ -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 @@
 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 \
diff -r 8f61792eacd4 -r ab1b4ab844dc lib/libterminfo/curterm.c
--- a/lib/libterminfo/curterm.c Sun Oct 02 19:15:39 2011 +0000
+++ b/lib/libterminfo/curterm.c Sun Oct 02 19:24:25 2011 +0000
@@ -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 @@
 del_curterm(TERMINAL *oterm)
 {
 
+       _DIAGASSERT(oterm != NULL);
        _ti_freeterm(oterm);
        return 0;
 }
+
+char *
+termname(void)
+{
+
+        _DIAGASSERT(cur_term != NULL);
+       return __UNCONST(cur_term->name);
+}
diff -r 8f61792eacd4 -r ab1b4ab844dc lib/libterminfo/term.h
--- a/lib/libterminfo/term.h    Sun Oct 02 19:15:39 2011 +0000
+++ b/lib/libterminfo/term.h    Sun Oct 02 19:24:25 2011 +0000
@@ -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 @@
 int            setupterm(const char *, int, int *);
 TERMINAL *     set_curterm(TERMINAL *);
 int            del_curterm(TERMINAL *);
+char *         termname(void);
 
 /* information functions */
 int            tigetflag(const char *);
diff -r 8f61792eacd4 -r ab1b4ab844dc lib/libterminfo/terminfo.3
--- a/lib/libterminfo/terminfo.3        Sun Oct 02 19:15:39 2011 +0000
+++ b/lib/libterminfo/terminfo.3        Sun Oct 02 19:24:25 2011 +0000
@@ -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 @@
 .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 ,



Home | Main Index | Thread Index | Old Index