tech-userlevel archive

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

Re: Add curses_version() in curses(3)



On 30/08/2019 17:45, Roy Marples wrote:
On 29/08/2019 14:27, Kamil Rytarowski wrote:
On 29.08.2019 15:23, Roy Marples wrote:
On 29/08/2019 14:19, Kamil Rytarowski wrote:
In my opinion artificial versioning (1.0.0) of native code adds no
interesting information and adds burden on us for superfluous versioning
model, orthogonal to __NetBSD_Version__.

Adding extra versioning would make sense if we could maintain curses(3)
out of the NetBSD context.

Minix and Void Linux use NetBSD curses, so yes it does make sense.
That does actually beg the question though - should we keep the version
in sync with the NetBSD release where it lives?


Minix uses just the NetBSD userland as it is. No need to do anything here.

For netbsd-curses, ported to Linux. It could be handled downstream
(probably appending a date of snapshot) if some other people would find
it useful.

But it's not our problem in src/.

New patch.

Cannot get version.c to depend on sys/sys/param.h for love nor money.
Can't get .PATH or .PHONY to work :/
Ideas on a postcard to fix that.

Attached this time.
? x
? x.c
Index: Makefile
===================================================================
RCS file: /cvsroot/src/lib/libcurses/Makefile,v
retrieving revision 1.90
diff -u -p -r1.90 Makefile
--- Makefile	22 Nov 2018 22:00:49 -0000	1.90
+++ Makefile	30 Aug 2019 16:42:35 -0000
@@ -5,6 +5,9 @@
 
 WARNS=	2
 
+CURSES_VERSION!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
+CPPFLAGS+=-DCURSES_VERSION=\"${CURSES_VERSION}\"
+
 CPPFLAGS+=-I${.CURDIR} -I${NETBSDSRCDIR}/lib/libterminfo
 .if defined(DEBUG_CURSES)
 CPPFLAGS+=-g -DDEBUG
@@ -25,7 +28,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 +40,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
 
Index: curses.3
===================================================================
RCS file: /cvsroot/src/lib/libcurses/curses.3,v
retrieving revision 1.73
diff -u -p -r1.73 curses.3
--- curses.3	25 Oct 2018 10:36:56 -0000	1.73
+++ curses.3	30 Aug 2019 16:42:35 -0000
@@ -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: curses.h
===================================================================
RCS file: /cvsroot/src/lib/libcurses/curses.h,v
retrieving revision 1.123
diff -u -p -r1.123 curses.h
--- curses.h	30 Sep 2018 10:55:00 -0000	1.123
+++ curses.h	30 Aug 2019 16:42:35 -0000
@@ -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);
Index: curses_version.3
===================================================================
RCS file: curses_version.3
diff -N curses_version.3
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ curses_version.3	30 Aug 2019 16:42:35 -0000
@@ -0,0 +1,60 @@
+.\"	$NetBSD: $
+.\"
+.\" 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: version.c
===================================================================
RCS file: version.c
diff -N version.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ version.c	30 Aug 2019 16:42:35 -0000
@@ -0,0 +1,44 @@
+/*	$NetBSD: $	*/
+
+/*-
+ * 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: $");
+#endif
+
+#include "curses.h"
+
+const char *
+curses_version()
+{
+
+	return "NetBSD-Curses " CURSES_VERSION " - " __DATE__;
+}


Home | Main Index | Thread Index | Old Index