Module Name:    src
Committed By:   roy
Date:           Mon Sep  2 09:08:29 UTC 2019

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/lib/libcurses: Makefile curses.3 curses.h
Added Files:
        src/lib/libcurses: curses_version.3 version.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.2284 -r1.2285 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.90 -r1.91 src/lib/libcurses/Makefile
cvs rdiff -u -r1.73 -r1.74 src/lib/libcurses/curses.3
cvs rdiff -u -r1.123 -r1.124 src/lib/libcurses/curses.h
cvs rdiff -u -r0 -r1.1 src/lib/libcurses/curses_version.3 \
    src/lib/libcurses/version.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2284 src/distrib/sets/lists/comp/mi:1.2285
--- src/distrib/sets/lists/comp/mi:1.2284	Wed Aug 28 21:48:14 2019
+++ src/distrib/sets/lists/comp/mi	Mon Sep  2 09:08:29 2019
@@ -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

Index: src/lib/libcurses/Makefile
diff -u src/lib/libcurses/Makefile:1.90 src/lib/libcurses/Makefile:1.91
--- src/lib/libcurses/Makefile:1.90	Thu Nov 22 22:00:49 2018
+++ src/lib/libcurses/Makefile	Mon Sep  2 09:08:29 2019
@@ -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 @@ SRCS=	acs.c addbytes.c addch.c addchnstr
 	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 @@ MAN=	curses.3 curses_addch.3 curses_addc
 	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 @@ SUBDIR.roff+= PSD.doc
 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>

Index: src/lib/libcurses/curses.3
diff -u src/lib/libcurses/curses.3:1.73 src/lib/libcurses/curses.3:1.74
--- src/lib/libcurses/curses.3:1.73	Thu Oct 25 10:36:56 2018
+++ src/lib/libcurses/curses.3	Mon Sep  2 09:08:29 2019
@@ -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 @@ must be called before any of the other r
 .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

Index: src/lib/libcurses/curses.h
diff -u src/lib/libcurses/curses.h:1.123 src/lib/libcurses/curses.h:1.124
--- src/lib/libcurses/curses.h:1.123	Sun Sep 30 10:55:00 2018
+++ src/lib/libcurses/curses.h	Mon Sep  2 09:08:29 2019
@@ -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_keypad(const WINDOW *);
 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);

Added files:

Index: src/lib/libcurses/curses_version.3
diff -u /dev/null src/lib/libcurses/curses_version.3:1.1
--- /dev/null	Mon Sep  2 09:08:29 2019
+++ src/lib/libcurses/curses_version.3	Mon Sep  2 09:08:29 2019
@@ -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 .
Index: src/lib/libcurses/version.c
diff -u /dev/null src/lib/libcurses/version.c:1.1
--- /dev/null	Mon Sep  2 09:08:29 2019
+++ src/lib/libcurses/version.c	Mon Sep  2 09:08:29 2019
@@ -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;
+}

Reply via email to