Module Name:    src
Committed By:   roy
Date:           Tue Sep  3 10:36:17 UTC 2019

Modified Files:
        src/lib/libcurses: Makefile curses.h version.c
Added Files:
        src/lib/libcurses: cursesrelease.sh

Log Message:
curses: Add __NetBSD_Curses_Version__

Similar to __NetBSD_Version__ from sys/param.h but has no
correlation to it or the ELF symver libcurses is built as.

If we say that v1 was everything prior to this, it makes sense to
start this from v2.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/lib/libcurses/Makefile
cvs rdiff -u -r1.124 -r1.125 src/lib/libcurses/curses.h
cvs rdiff -u -r0 -r1.1 src/lib/libcurses/cursesrelease.sh
cvs rdiff -u -r1.1 -r1.2 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/lib/libcurses/Makefile
diff -u src/lib/libcurses/Makefile:1.91 src/lib/libcurses/Makefile:1.92
--- src/lib/libcurses/Makefile:1.91	Mon Sep  2 09:08:29 2019
+++ src/lib/libcurses/Makefile	Tue Sep  3 10:36:17 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.91 2019/09/02 09:08:29 roy Exp $
+#	$NetBSD: Makefile,v 1.92 2019/09/03 10:36:17 roy Exp $
 #	@(#)Makefile	8.2 (Berkeley) 1/2/94
 
 .include <bsd.own.mk>
@@ -210,10 +210,8 @@ 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
+CURSES_VERSION!=	${HOST_SH} ${.CURDIR}/cursesrelease.sh
+CPPFLAGS.version.c+=	-DCURSES_VERSION=\"${CURSES_VERSION}\"
 
 .include <bsd.lib.mk>
 .include <bsd.subdir.mk>

Index: src/lib/libcurses/curses.h
diff -u src/lib/libcurses/curses.h:1.124 src/lib/libcurses/curses.h:1.125
--- src/lib/libcurses/curses.h:1.124	Mon Sep  2 09:08:29 2019
+++ src/lib/libcurses/curses.h	Tue Sep  3 10:36:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: curses.h,v 1.124 2019/09/02 09:08:29 roy Exp $	*/
+/*	$NetBSD: curses.h,v 1.125 2019/09/03 10:36:17 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -48,6 +48,23 @@
 #include <stdbool.h>
 
 /*
+ *	#define __NetBSD_Curses_Version__ MMmmrrpp00
+ *
+ * M = major version
+ * m = minor version; a minor number of 99 indicates current
+ * r = 0 (*)
+ * p = patchlevel
+ *
+ * This is similar to __NetBSD_Version__ as found in sys/param.h
+ * It is maintained seperately and has no correlation to it or the
+ * ELF symver libcurses is built as.
+ */
+#define	__NetBSD_Curses_Version__	0200000000 /* NetBSD-Curses 2.0.0 */
+
+#define __NetBSD_Curses_Prereq__(M,m,p) (((((M) * 100000000) + \
+	        (m) * 1000000) + (p) * 100) <= __NetBSD_Curses_Version__)
+
+/*
  * attr_t must be the same size as wchar_t (see <wchar.h>) to avoid padding
  * in __LDATA.
  */

Index: src/lib/libcurses/version.c
diff -u src/lib/libcurses/version.c:1.1 src/lib/libcurses/version.c:1.2
--- src/lib/libcurses/version.c:1.1	Mon Sep  2 09:08:29 2019
+++ src/lib/libcurses/version.c	Tue Sep  3 10:36:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: version.c,v 1.1 2019/09/02 09:08:29 roy Exp $	*/
+/*	$NetBSD: version.c,v 1.2 2019/09/03 10:36:17 roy Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: version.c,v 1.1 2019/09/02 09:08:29 roy Exp $");
+__RCSID("$NetBSD: version.c,v 1.2 2019/09/03 10:36:17 roy Exp $");
 #endif
 
 #include "curses.h"
@@ -40,5 +40,5 @@ const char *
 curses_version()
 {
 
-	return "NetBSD-Curses " NETBSD_VERSION;
+	return "NetBSD-Curses " CURSES_VERSION;
 }

Added files:

Index: src/lib/libcurses/cursesrelease.sh
diff -u /dev/null src/lib/libcurses/cursesrelease.sh:1.1
--- /dev/null	Tue Sep  3 10:36:17 2019
+++ src/lib/libcurses/cursesrelease.sh	Tue Sep  3 10:36:17 2019
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+#	$NetBSD: cursesrelease.sh,v 1.1 2019/09/03 10:36:17 roy Exp $
+#
+# Copyright (c) 1997 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Luke Mewburn.
+#
+# 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.
+#
+
+# We use the number specified in <curses.h>
+
+path="$0"
+[ "${path#/*}" = "$path" ] && path="./$path"
+exec < ${path%/*}/curses.h
+
+# Search for line
+# #define __NetBSD_Curses_Version__ <ver_num> /* NetBSD-Curses <ver_text> */
+#
+# <ver_num> and <ver_text> should match!
+
+while
+	read define ver_tag rel_num comment_start NetBSD rel_text rest || exit 1
+do
+	[ "$define" = "#define" ] || continue;
+	[ "$ver_tag" = "__NetBSD_Curses_Version__" ] || continue
+	break
+done
+
+# ${rel_num} is [M]Mmm00pp00
+rel_num=${rel_num%??}
+rel_MMmm=${rel_num%????}
+rel_MM=${rel_MMmm%??}
+rel_mm=${rel_MMmm#${rel_MM}}
+rel_pp=${rel_num#${rel_MMmm}00}
+
+echo "${rel_MM#0}.${rel_mm#0}.${rel_pp#0}"

Reply via email to