Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libterminfo For platforms where we cannot fit a char * i...
details: https://anonhg.NetBSD.org/src/rev/bcf3f657e926
branches: trunk
changeset: 784324:bcf3f657e926
user: roy <roy%NetBSD.org@localhost>
date: Fri Jan 25 12:30:05 2013 +0000
description:
For platforms where we cannot fit a char * into a long, return NULL
and set errno to ENOTSUPP.
diffstat:
lib/libterminfo/terminfo.3 | 10 ++++++++--
lib/libterminfo/tparm.c | 29 +++++++++++++++++++++--------
2 files changed, 29 insertions(+), 10 deletions(-)
diffs (81 lines):
diff -r 87039993c226 -r bcf3f657e926 lib/libterminfo/terminfo.3
--- a/lib/libterminfo/terminfo.3 Fri Jan 25 12:27:13 2013 +0000
+++ b/lib/libterminfo/terminfo.3 Fri Jan 25 12:30:05 2013 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: terminfo.3,v 1.8 2011/10/04 11:01:14 roy Exp $
+.\" $NetBSD: terminfo.3,v 1.9 2013/01/25 12:30:05 roy Exp $
.\"
.\" Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd October 4, 2011
+.Dd January 25, 2013
.Dt TERMINFO 3
.Os
.Sh NAME
@@ -187,6 +187,12 @@
pointer inside a
.Vt long
can use them.
+For platforms which don't support this,
+.Dv NULL
+is returned and
+.Va errno
+is set to
+.Er ENOTSUPP .
The string encoding and parameter application is described in
.Xr terminfo 5 .
.Pp
diff -r 87039993c226 -r bcf3f657e926 lib/libterminfo/tparm.c
--- a/lib/libterminfo/tparm.c Fri Jan 25 12:27:13 2013 +0000
+++ b/lib/libterminfo/tparm.c Fri Jan 25 12:30:05 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tparm.c,v 1.12 2013/01/24 10:41:28 roy Exp $ */
+/* $NetBSD: tparm.c,v 1.13 2013/01/25 12:30:05 roy Exp $ */
/*
* Copyright (c) 2009, 2011, 2013 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: tparm.c,v 1.12 2013/01/24 10:41:28 roy Exp $");
+__RCSID("$NetBSD: tparm.c,v 1.13 2013/01/25 12:30:05 roy Exp $");
#include <sys/param.h>
#include <assert.h>
@@ -223,12 +223,25 @@
/* Put our parameters into variables */
memset(¶ms, 0, sizeof(params));
for (l = 0; l < max; l++) {
- if (piss[l])
- params[l].string = va_arg(parms, char *);
- else if (va_long)
- params[l].num = va_arg(parms, long);
- else
- params[l].num = (long)va_arg(parms, int);
+ if (piss[l]) {
+ if (va_long) {
+ /* This only works if char * fits into a long
+ * on this platform. */
+ if (sizeof(char *) <= sizeof(long)/*CONSTCOND*/)
+ params[l].string =
+ (char *)va_arg(parms, long);
+ else {
+ errno = ENOTSUP;
+ return NULL;
+ }
+ } else
+ params[l].string = va_arg(parms, char *);
+ } else {
+ if (va_long)
+ params[l].num = va_arg(parms, long);
+ else
+ params[l].num = (long)va_arg(parms, int);
+ }
}
memset(&stack, 0, sizeof(stack));
Home |
Main Index |
Thread Index |
Old Index