Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses curses(3): add curses_version()



details:   https://anonhg.NetBSD.org/src/rev/24f474f78a7e
branches:  trunk
changeset: 965153:24f474f78a7e
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Sep 02 09:08:29 2019 +0000

description:
curses(3): add curses_version()

Returns NetBSD-Curses %s
Where %s is the NetBSD version taken from sys/param.h

Discussed on tech-net@, only for ncurses compat.

diffstat:

 distrib/sets/lists/comp/mi     |   5 ++-
 lib/libcurses/Makefile         |  12 ++++++--
 lib/libcurses/curses.3         |   5 ++-
 lib/libcurses/curses.h         |   5 ++-
 lib/libcurses/curses_version.3 |  60 ++++++++++++++++++++++++++++++++++++++++++
 lib/libcurses/version.c        |  44 ++++++++++++++++++++++++++++++
 6 files changed, 124 insertions(+), 7 deletions(-)

diffs (229 lines):

diff -r c89e444f242a -r 24f474f78a7e distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Mon Sep 02 08:26:00 2019 +0000
+++ b/distrib/sets/lists/comp/mi        Mon Sep 02 09:08:29 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.2284 2019/08/28 21:48:14 rmind Exp $
+#      $NetBSD: mi,v 1.2285 2019/09/02 09:08:29 roy Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp                           comp-sys-root
@@ -6336,6 +6336,7 @@
 ./usr/share/man/cat3/curses_touch.0            comp-c-catman           .cat
 ./usr/share/man/cat3/curses_tty.0              comp-c-catman           .cat
 ./usr/share/man/cat3/curses_underscore.0       comp-c-catman           .cat
+./usr/share/man/cat3/curses_version.0          comp-c-catman           .cat
 ./usr/share/man/cat3/curses_window.0           comp-c-catman           .cat
 ./usr/share/man/cat3/cuserid.0                 comp-c-catman           .cat
 ./usr/share/man/cat3/d2i_ASN1_OBJECT.0 comp-c-catman   .cat,openssl=10
@@ -14342,6 +14343,7 @@
 ./usr/share/man/html3/curses_touch.html                comp-c-htmlman          html
 ./usr/share/man/html3/curses_tty.html          comp-c-htmlman          html
 ./usr/share/man/html3/curses_underscore.html   comp-c-htmlman          html
+./usr/share/man/html3/curses_version.html      comp-c-htmlman          html
 ./usr/share/man/html3/curses_window.html       comp-c-htmlman          html
 ./usr/share/man/html3/cuserid.html             comp-c-htmlman          html
 ./usr/share/man/html3/d2i_ASN1_OBJECT.html     comp-c-htmlman  html,openssl=10
@@ -22291,6 +22293,7 @@
 ./usr/share/man/man3/curses_touch.3            comp-c-man              .man
 ./usr/share/man/man3/curses_tty.3              comp-c-man              .man
 ./usr/share/man/man3/curses_underscore.3       comp-c-man              .man
+./usr/share/man/man3/curses_version.3          comp-c-man              .man
 ./usr/share/man/man3/curses_window.3           comp-c-man              .man
 ./usr/share/man/man3/cuserid.3                 comp-c-man              .man
 ./usr/share/man/man3/d2i_ASN1_OBJECT.3 comp-c-man      .man,openssl=10
diff -r c89e444f242a -r 24f474f78a7e lib/libcurses/Makefile
--- a/lib/libcurses/Makefile    Mon Sep 02 08:26:00 2019 +0000
+++ b/lib/libcurses/Makefile    Mon Sep 02 09:08:29 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.90 2018/11/22 22:00:49 uwe Exp $
+#      $NetBSD: Makefile,v 1.91 2019/09/02 09:08:29 roy Exp $
 #      @(#)Makefile    8.2 (Berkeley) 1/2/94
 
 .include <bsd.own.mk>
@@ -25,7 +25,7 @@
        mvwin.c newwin.c nodelay.c notimeout.c overlay.c overwrite.c pause.c \
        printw.c putchar.c refresh.c resize.c ripoffline.c scanw.c screen.c \
        scroll.c scrollok.c setterm.c slk.c standout.c syncok.c timeout.c \
-       toucholap.c touchwin.c tstp.c tty.c unctrl.c underscore.c
+       toucholap.c touchwin.c tstp.c tty.c unctrl.c underscore.c version.c
 
 MAN=   curses.3 curses_addch.3 curses_addchstr.3 curses_addstr.3 \
        curses_attributes.3 curses_background.3 curses_border.3 \
@@ -37,7 +37,8 @@
        curses_insdelln.3 curses_keyname.3 curses_line.3 curses_pad.3 \
        curses_print.3 curses_refresh.3 curses_scanw.3 curses_screen.3 \
        curses_scroll.3 curses_slk.3 curses_standout.3 curses_termcap.3 \
-       curses_touch.3 curses_tty.3 curses_underscore.3 curses_window.3
+       curses_touch.3 curses_tty.3 curses_underscore.3 curses_version.3 \
+       curses_window.3
 INCS=  curses.h unctrl.h
 INCSDIR=/usr/include
 
@@ -209,5 +210,10 @@
 fileio.h: shlib_version genfileioh.awk
        ${TOOL_AWK} -f ${.CURDIR}/genfileioh.awk < ${.CURDIR}/shlib_version > ${.CURDIR}/fileio.h
 
+NETBSD_VERSION!=       ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
+CPPFLAGS.version.c+=   -DNETBSD_VERSION=\"${NETBSD_VERSION}\"
+.PATH:                 ${NETBSDSRCDIR}/sys/sys
+version.o:             param.h
+
 .include <bsd.lib.mk>
 .include <bsd.subdir.mk>
diff -r c89e444f242a -r 24f474f78a7e lib/libcurses/curses.3
--- a/lib/libcurses/curses.3    Mon Sep 02 08:26:00 2019 +0000
+++ b/lib/libcurses/curses.3    Mon Sep 02 09:08:29 2019 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: curses.3,v 1.73 2018/10/25 10:36:56 uwe Exp $
+.\"    $NetBSD: curses.3,v 1.74 2019/09/02 09:08:29 roy Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"     @(#)curses.3   8.1 (Berkeley) 6/4/93
 .\"
-.Dd October 25, 2018
+.Dd August 29, 2019
 .Dt CURSES 3
 .Os
 .Sh NAME
@@ -96,6 +96,7 @@
 .It color_set Ta Xr curses_attributes 3
 .It copywin Ta Xr curses_window 3
 .It curs_set Ta Xr curses_tty 3
+.It curses_version Ta Xr curses_version 3
 .It def_prog_mode Ta Xr curses_tty 3
 .It def_shell_mode Ta Xr curses_tty 3
 .It define_key Ta Xr curses_input 3
diff -r c89e444f242a -r 24f474f78a7e lib/libcurses/curses.h
--- a/lib/libcurses/curses.h    Mon Sep 02 08:26:00 2019 +0000
+++ b/lib/libcurses/curses.h    Mon Sep 02 09:08:29 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: curses.h,v 1.123 2018/09/30 10:55:00 kamil Exp $       */
+/*     $NetBSD: curses.h,v 1.124 2019/09/02 09:08:29 roy Exp $ */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -980,6 +980,9 @@
 bool is_leaveok(const WINDOW *);
 bool is_pad(const WINDOW *);
 
+/* ncurses version for compat */
+const char *curses_version(void);
+
 /* Private functions that are needed for user programs prototypes. */
 int     __cputchar(int);
 int     __waddbytes(WINDOW *, const char *, int, attr_t);
diff -r c89e444f242a -r 24f474f78a7e lib/libcurses/curses_version.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libcurses/curses_version.3    Mon Sep 02 09:08:29 2019 +0000
@@ -0,0 +1,60 @@
+.\"    $NetBSD: curses_version.3,v 1.1 2019/09/02 09:08:29 roy Exp $
+.\"
+.\" Copyright (c) 2019 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Roy Marples.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.\"
+.Dd August 29, 2019
+.Dt CURSES_VERSION 3
+.Os
+.Sh NAME
+.Nm curses_version
+.Nd Curses version information
+.Sh LIBRARY
+.Lb libcurses
+.Sh SYNOPSIS
+.In curses.h
+.Ft const char *
+.Fn curses_version "void"
+.Sh DESCRIPTION
+The
+.Fn curses_version
+function returns a read-only string representing the version of the
+.Nx
+curses library.
+This has no relation to the
+.Nx
+release it might have been taken from.
+.Sh SEE ALSO
+.Xr curses 3
+.Sh HISTORY
+The
+.Fn curses_version
+function is a
+.Em ncurses
+extension to the Curses library and was added in
+.Nx 10.0 .
diff -r c89e444f242a -r 24f474f78a7e lib/libcurses/version.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libcurses/version.c   Mon Sep 02 09:08:29 2019 +0000
@@ -0,0 +1,44 @@
+/*     $NetBSD: version.c,v 1.1 2019/09/02 09:08:29 roy Exp $  */
+
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Roy Marples.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: version.c,v 1.1 2019/09/02 09:08:29 roy Exp $");
+#endif
+
+#include "curses.h"
+
+const char *
+curses_version()
+{
+
+       return "NetBSD-Curses " NETBSD_VERSION;
+}



Home | Main Index | Thread Index | Old Index