CVS commit: src/sys/dev/pci

2021-02-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  8 06:56:26 UTC 2021

Modified Files:
src/sys/dev/pci: if_vioif.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/if_vioif.c

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

Modified files:

Index: src/sys/dev/pci/if_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.69 src/sys/dev/pci/if_vioif.c:1.70
--- src/sys/dev/pci/if_vioif.c:1.69	Wed Feb  3 21:04:41 2021
+++ src/sys/dev/pci/if_vioif.c	Mon Feb  8 06:56:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.69 2021/02/03 21:04:41 reinoud Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.70 2021/02/08 06:56:26 skrll Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.69 2021/02/03 21:04:41 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.70 2021/02/08 06:56:26 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1669,12 +1669,12 @@ vioif_rx_handle_locked(void *xrxq, u_int
 	if (more) {
 		vioif_rx_sched_handle(sc, rxq);
 		return;
-	} 
+	}
 	more = virtio_start_vq_intr(vsc, rxq->rxq_vq);
 	if (more) {
 		vioif_rx_sched_handle(sc, rxq);
 		return;
-	} 
+	}
 	atomic_store_relaxed(>rxq_active, false);
 }
 
@@ -1777,7 +1777,7 @@ vioif_tx_handle_locked(struct vioif_txqu
 		return;
 	}
 
-	if (virtio_features(vsc) & VIRTIO_F_RING_EVENT_IDX) 
+	if (virtio_features(vsc) & VIRTIO_F_RING_EVENT_IDX)
 		more = virtio_postpone_intr_smart(vsc, vq);
 	else
 		more = virtio_start_vq_intr(vsc, vq);



CVS commit: src/sys/dev/pci

2021-02-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  8 06:56:26 UTC 2021

Modified Files:
src/sys/dev/pci: if_vioif.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/if_vioif.c

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



Re: CVS commit: src/sys

2021-02-07 Thread Roy Marples

On 04/02/2021 20:18, matthew green wrote:

Roy Marples writes:

On 03/02/2021 21:45, David Young wrote:

On Wed, Feb 03, 2021 at 05:51:40AM +, Roy Marples wrote:

Module Name:src
Committed By:   roy
Date:   Wed Feb  3 05:51:40 UTC 2021

Modified Files:
src/sys/net: if_arp.h if_ether.h if_gre.h
src/sys/netinet: if_ether.h igmp.h in.h ip.h ip6.h ip_carp.h ip_icmp.h
ip_mroute.h ip_var.h tcp.h tcp_debug.h tcp_var.h udp.h udp_var.h

Log Message:
Remove __packed from various network structures

They are already network aligned and adding the __packed attribute
just causes needless compiler warnings about accssing members of packed
objects.


This change looks a little hasty to me.

It looks to me like some of these structs were __packed so that
they could be read/written directly from/to any offset in a packet
chain using mtod(), which does not pay any mind to the alignment
of `*t`:

#define mtod(m, t)  ((t)((m)->m_data))

I see gre_h is accessed in that way, just for one example.  I don't
see any reason in principle that every gre_h accessed through mtod()
should be 16-bit aligned in its buffer, but that is the alignment
the compiler will expect if gre_h is not __packed.  If the actual
alignment ever differs from compiler's expectation, then there
could be a bus error or an unwanted byte rotation/shift.

It looks to me like there's a bit of cleanup to do elsewhere before
removing __packed from network structures.


ssh over a gre tunnel using erlite (mips64) and pinebook (aarch64) as both ends
seems to work fine. I also tested an amd64 endpoint.

Not that I disagree with your assessment that the code can always be improved.


i looked at removing __packed from these when GCC 9 came
around and really started complaining about them.  however,
i was not able to convince myself that all the users were
actually safe if __packed was removed.

in particular, 'struct ip' has 4-byte objects at offset
14, 18, 22, and 26.  code accessing data directly from the
network may fail, and eg, mtod() makes it virtually
impossible to check for this at compile time.  sanitizers
could check at run time.


Isn't that already solved here?
http://anonhg.netbsd.org/src/rev/9f66cecd950e

And if I'm not wrong, just ignoring the warning causes alignment failures as it 
stands? So it's just swapping one bad thing with another? If so, then there is 
no right answer other than doing similar alignment checks for our mbufs.


Roy


CVS commit: src/lib/libc/sys

2021-02-07 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Feb  8 01:00:49 UTC 2021

Modified Files:
src/lib/libc/sys: kill.2

Log Message:
clarify what happens when kill(-1, ...) does nothing


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/sys/kill.2

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

Modified files:

Index: src/lib/libc/sys/kill.2
diff -u src/lib/libc/sys/kill.2:1.23 src/lib/libc/sys/kill.2:1.24
--- src/lib/libc/sys/kill.2:1.23	Tue Jul 15 17:39:21 2014
+++ src/lib/libc/sys/kill.2	Mon Feb  8 01:00:49 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kill.2,v 1.23 2014/07/15 17:39:21 wiz Exp $
+.\"	$NetBSD: kill.2,v 1.24 2021/02/08 01:00:49 nia Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)kill.2	8.3 (Berkeley) 4/19/94
 .\"
-.Dd July 9, 2014
+.Dd February 8, 2021
 .Dt KILL 2
 .Os
 .Sh NAME
@@ -85,7 +85,9 @@ the signal is sent to all processes excl
 system processes and the process sending the signal.
 If the user is not the super user, the signal is sent to all processes
 with the same uid as the user excluding the process sending the signal.
-No error is returned if any process could be signaled.
+No error is returned if any process could be signaled, otherwise
+.Er ESRCH
+is returned.
 .El
 .Pp
 For compatibility with System V,



CVS commit: src/lib/libc/sys

2021-02-07 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Mon Feb  8 01:00:49 UTC 2021

Modified Files:
src/lib/libc/sys: kill.2

Log Message:
clarify what happens when kill(-1, ...) does nothing


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/sys/kill.2

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



CVS commit: src/sys/arch/evbmips/conf

2021-02-07 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Feb  8 00:47:53 UTC 2021

Modified Files:
src/sys/arch/evbmips/conf: ADM5120 ADM5120-NB ADM5120-USB ALCHEMY
MIPSSIM

Log Message:
Comment out HZ=512.  This was only intended to be enabled for profiling.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/evbmips/conf/ADM5120 \
src/sys/arch/evbmips/conf/ADM5120-USB
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbmips/conf/ADM5120-NB
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/evbmips/conf/ALCHEMY
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbmips/conf/MIPSSIM

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



CVS commit: src/sys/arch/evbmips/conf

2021-02-07 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Feb  8 00:47:53 UTC 2021

Modified Files:
src/sys/arch/evbmips/conf: ADM5120 ADM5120-NB ADM5120-USB ALCHEMY
MIPSSIM

Log Message:
Comment out HZ=512.  This was only intended to be enabled for profiling.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/evbmips/conf/ADM5120 \
src/sys/arch/evbmips/conf/ADM5120-USB
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbmips/conf/ADM5120-NB
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/evbmips/conf/ALCHEMY
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbmips/conf/MIPSSIM

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

Modified files:

Index: src/sys/arch/evbmips/conf/ADM5120
diff -u src/sys/arch/evbmips/conf/ADM5120:1.31 src/sys/arch/evbmips/conf/ADM5120:1.32
--- src/sys/arch/evbmips/conf/ADM5120:1.31	Mon Feb  8 00:35:25 2021
+++ src/sys/arch/evbmips/conf/ADM5120	Mon Feb  8 00:47:53 2021
@@ -1,11 +1,11 @@
-#	$NetBSD: ADM5120,v 1.31 2021/02/08 00:35:25 simonb Exp $
+#	$NetBSD: ADM5120,v 1.32 2021/02/08 00:47:53 simonb Exp $
 #
 # Kernel config for the ADM5120 based boards and routers,
 # including the RouterBOARD 100 series.
 
 include 	"arch/evbmips/conf/std.adm5120"
 
-#ident 		"GENERIC-$Revision: 1.31 $"
+#ident 		"GENERIC-$Revision: 1.32 $"
 
 maxusers	32
 
@@ -13,7 +13,7 @@ options 	MIPS32
 options 	NOFPU		# No FPU
 options 	FPEMUL		# emulate FPU insn
 #options 	CONSPEED=115200	# YAMON default
-options 	HZ=512		# for profiling
+#options 	HZ=512		# for profiling
 options 	MEMSIZE="(16*1024*1024)"
 
 #options 	LOCKDEBUG
Index: src/sys/arch/evbmips/conf/ADM5120-USB
diff -u src/sys/arch/evbmips/conf/ADM5120-USB:1.31 src/sys/arch/evbmips/conf/ADM5120-USB:1.32
--- src/sys/arch/evbmips/conf/ADM5120-USB:1.31	Mon Feb  8 00:35:25 2021
+++ src/sys/arch/evbmips/conf/ADM5120-USB	Mon Feb  8 00:47:53 2021
@@ -1,11 +1,11 @@
-#	$NetBSD: ADM5120-USB,v 1.31 2021/02/08 00:35:25 simonb Exp $
+#	$NetBSD: ADM5120-USB,v 1.32 2021/02/08 00:47:53 simonb Exp $
 #
 # Kernel config for the ADM5120 based boards and routers,
 # including the RouterBOARD 100 series.
 
 include 	"arch/evbmips/conf/std.adm5120"
 
-#ident 		"GENERIC-$Revision: 1.31 $"
+#ident 		"GENERIC-$Revision: 1.32 $"
 
 maxusers	32
 
@@ -13,7 +13,7 @@ options 	MIPS32
 options 	NOFPU		# No FPU
 options 	FPEMUL		# emulate FPU insn
 options		CONSPEED=115200	# YAMON default
-options 	HZ=512		# for profiling
+#options 	HZ=512		# for profiling
 
 #options 	LOCKDEBUG
 options 	SOSEND_COUNTERS

Index: src/sys/arch/evbmips/conf/ADM5120-NB
diff -u src/sys/arch/evbmips/conf/ADM5120-NB:1.29 src/sys/arch/evbmips/conf/ADM5120-NB:1.30
--- src/sys/arch/evbmips/conf/ADM5120-NB:1.29	Mon Feb  8 00:35:25 2021
+++ src/sys/arch/evbmips/conf/ADM5120-NB	Mon Feb  8 00:47:53 2021
@@ -1,11 +1,11 @@
-#	$NetBSD: ADM5120-NB,v 1.29 2021/02/08 00:35:25 simonb Exp $
+#	$NetBSD: ADM5120-NB,v 1.30 2021/02/08 00:47:53 simonb Exp $
 #
 # Kernel config for the ADM5120 based boards and routers,
 # including the RouterBOARD 100 series.
 
 include 	"arch/evbmips/conf/std.adm5120"
 
-#ident 		"GENERIC-$Revision: 1.29 $"
+#ident 		"GENERIC-$Revision: 1.30 $"
 
 maxusers	32
 
@@ -13,7 +13,7 @@ options 	MIPS32
 options 	NOFPU		# No FPU
 options 	FPEMUL		# emulate FPU insn
 #options 	CONSPEED=115200	# YAMON default
-options 	HZ=512		# for profiling
+#options 	HZ=512		# for profiling
 options 	MEMSIZE="(16*1024*1024)"
 
 #options 	LOCKDEBUG

Index: src/sys/arch/evbmips/conf/ALCHEMY
diff -u src/sys/arch/evbmips/conf/ALCHEMY:1.70 src/sys/arch/evbmips/conf/ALCHEMY:1.71
--- src/sys/arch/evbmips/conf/ALCHEMY:1.70	Sun Sep 27 13:48:50 2020
+++ src/sys/arch/evbmips/conf/ALCHEMY	Mon Feb  8 00:47:53 2021
@@ -1,11 +1,11 @@
-#	$NetBSD: ALCHEMY,v 1.70 2020/09/27 13:48:50 roy Exp $
+#	$NetBSD: ALCHEMY,v 1.71 2021/02/08 00:47:53 simonb Exp $
 #
 # Kernel config for the Alchemy Semiconductor (AMD) PB1000, PB1500,
 # DBAu1000 and DBAu1500 evaluation boards.
 
 include 	"arch/evbmips/conf/std.alchemy"
 
-#ident 		"ALCHEMY-$Revision: 1.70 $"
+#ident 		"ALCHEMY-$Revision: 1.71 $"
 
 maxusers	32
 
@@ -13,7 +13,7 @@ options 	MIPS32
 options 	NOFPU		# No FPU
 options 	FPEMUL		# emulate FPU insn
 #options 	CONSPEED=115200	# YAMON default
-options 	HZ=512		# for profiling
+#options 	HZ=512		# for profiling
 
 # CPU support
 options 	ALCHEMY_AU1000

Index: src/sys/arch/evbmips/conf/MIPSSIM
diff -u src/sys/arch/evbmips/conf/MIPSSIM:1.1 src/sys/arch/evbmips/conf/MIPSSIM:1.2
--- src/sys/arch/evbmips/conf/MIPSSIM:1.1	Wed Jan 27 05:24:16 2021
+++ src/sys/arch/evbmips/conf/MIPSSIM	Mon Feb  8 00:47:53 2021
@@ -1,10 +1,10 @@
-# $NetBSD: MIPSSIM,v 1.1 2021/01/27 05:24:16 simonb Exp $
+# $NetBSD: MIPSSIM,v 1.2 2021/02/08 00:47:53 simonb Exp $
 #
 # Kernel config for the QEMU MIPS "mipssim" simulator
 
 include 	"arch/evbmips/conf/std.mipssim"
 
-#ident 		"GENERIC-$Revision: 1.1 $"
+#ident 		"GENERIC-$Revision: 1.2 $"
 
 maxusers	32
 
@@ -12,7 +12,7 

CVS commit: src/sys/arch/evbmips/conf

2021-02-07 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Feb  8 00:35:26 UTC 2021

Modified Files:
src/sys/arch/evbmips/conf: ADM5120 ADM5120-NB ADM5120-USB

Log Message:
Correct the comment at the top of these config files identifying what
they run on.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/evbmips/conf/ADM5120 \
src/sys/arch/evbmips/conf/ADM5120-USB
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/evbmips/conf/ADM5120-NB

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

Modified files:

Index: src/sys/arch/evbmips/conf/ADM5120
diff -u src/sys/arch/evbmips/conf/ADM5120:1.30 src/sys/arch/evbmips/conf/ADM5120:1.31
--- src/sys/arch/evbmips/conf/ADM5120:1.30	Tue May 19 09:26:44 2020
+++ src/sys/arch/evbmips/conf/ADM5120	Mon Feb  8 00:35:25 2021
@@ -1,11 +1,11 @@
-#	$NetBSD: ADM5120,v 1.30 2020/05/19 09:26:44 rin Exp $
+#	$NetBSD: ADM5120,v 1.31 2021/02/08 00:35:25 simonb Exp $
 #
-# Kernel config for the Alchemy Semiconductor (AMD) PB1000, PB1500,
-# DBAu1000 and DBAu1500 evaluation boards.
+# Kernel config for the ADM5120 based boards and routers,
+# including the RouterBOARD 100 series.
 
 include 	"arch/evbmips/conf/std.adm5120"
 
-#ident 		"GENERIC-$Revision: 1.30 $"
+#ident 		"GENERIC-$Revision: 1.31 $"
 
 maxusers	32
 
Index: src/sys/arch/evbmips/conf/ADM5120-USB
diff -u src/sys/arch/evbmips/conf/ADM5120-USB:1.30 src/sys/arch/evbmips/conf/ADM5120-USB:1.31
--- src/sys/arch/evbmips/conf/ADM5120-USB:1.30	Tue May 19 09:26:44 2020
+++ src/sys/arch/evbmips/conf/ADM5120-USB	Mon Feb  8 00:35:25 2021
@@ -1,11 +1,11 @@
-#	$NetBSD: ADM5120-USB,v 1.30 2020/05/19 09:26:44 rin Exp $
+#	$NetBSD: ADM5120-USB,v 1.31 2021/02/08 00:35:25 simonb Exp $
 #
-# Kernel config for the Alchemy Semiconductor (AMD) PB1000, PB1500,
-# DBAu1000 and DBAu1500 evaluation boards.
+# Kernel config for the ADM5120 based boards and routers,
+# including the RouterBOARD 100 series.
 
 include 	"arch/evbmips/conf/std.adm5120"
 
-#ident 		"GENERIC-$Revision: 1.30 $"
+#ident 		"GENERIC-$Revision: 1.31 $"
 
 maxusers	32
 

Index: src/sys/arch/evbmips/conf/ADM5120-NB
diff -u src/sys/arch/evbmips/conf/ADM5120-NB:1.28 src/sys/arch/evbmips/conf/ADM5120-NB:1.29
--- src/sys/arch/evbmips/conf/ADM5120-NB:1.28	Tue May 19 09:26:44 2020
+++ src/sys/arch/evbmips/conf/ADM5120-NB	Mon Feb  8 00:35:25 2021
@@ -1,11 +1,11 @@
-#	$NetBSD: ADM5120-NB,v 1.28 2020/05/19 09:26:44 rin Exp $
+#	$NetBSD: ADM5120-NB,v 1.29 2021/02/08 00:35:25 simonb Exp $
 #
-# Kernel config for the Alchemy Semiconductor (AMD) PB1000, PB1500,
-# DBAu1000 and DBAu1500 evaluation boards.
+# Kernel config for the ADM5120 based boards and routers,
+# including the RouterBOARD 100 series.
 
 include 	"arch/evbmips/conf/std.adm5120"
 
-#ident 		"GENERIC-$Revision: 1.28 $"
+#ident 		"GENERIC-$Revision: 1.29 $"
 
 maxusers	32
 



CVS commit: src/sys/arch/evbmips/conf

2021-02-07 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Mon Feb  8 00:35:26 UTC 2021

Modified Files:
src/sys/arch/evbmips/conf: ADM5120 ADM5120-NB ADM5120-USB

Log Message:
Correct the comment at the top of these config files identifying what
they run on.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/evbmips/conf/ADM5120 \
src/sys/arch/evbmips/conf/ADM5120-USB
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/evbmips/conf/ADM5120-NB

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



CVS commit: src/tests/lib/libcurses/tests

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 23:30:33 UTC 2021

Modified Files:
src/tests/lib/libcurses/tests: addch

Log Message:
tests/libcurses: fix undefined behavior in test addch

The libcurses framework is not strictly typed and thus provides plenty
of ways to shoot yourself in the foot.  It's a waste of time debugging
things that a proper programming language can easily prevent.

The function addch expects an argument of type 'chtype'.  Passing a
"double-quoted" string does not match this, as 'chtype' is completely
different from a plain 'char'.  Instead, functions taking a 'chtype'
must be passed a `backtick-quoted` string.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libcurses/tests/addch

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

Modified files:

Index: src/tests/lib/libcurses/tests/addch
diff -u src/tests/lib/libcurses/tests/addch:1.4 src/tests/lib/libcurses/tests/addch:1.5
--- src/tests/lib/libcurses/tests/addch:1.4	Sun Feb  7 13:06:02 2021
+++ src/tests/lib/libcurses/tests/addch	Sun Feb  7 23:30:33 2021
@@ -3,23 +3,22 @@ call OK addch `\001t`
 call OK refresh
 call OK mvaddch 5 3 `\003e`
 call OK refresh
-call OK addch "\n"
+call OK addch `\000\n`
 
 # Somewhere between NetBSD 8.0 and 9.0, a bug was added to addch that
 # doubled the spaces for a tab.  Instead of 8 spaces, there are now 16.
-call OK addch "\t"
+call OK addch `\000\t`
 call2 6 16 getyx STDSCR		# FIXME: must be 8, not 16
-call OK addch "8"
-call OK addch "\n"
+call OK addch `\0008`
+call OK addch `\000\n`
 
 # Somewhere between NetBSD 8.0 and 9.0, a bug was added to addch that
 # doubled the spaces for a tab.  Instead of 1 space, there are now 2.
 call OK addstr "0123456"
-call OK addch "\t"
-call2 7 9 getyx STDSCR		# FIXME: with probability around 50%, the
-# 7 comes out as a 6.
-call OK addch "8"
-call OK addch "\n"
+call OK addch `\000\t`
+call2 7 9 getyx STDSCR
+call OK addch `\0008`
+call OK addch `\000\n`
 
 call OK refresh
 compare addch.chk



CVS commit: src/tests/lib/libcurses/tests

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 23:30:33 UTC 2021

Modified Files:
src/tests/lib/libcurses/tests: addch

Log Message:
tests/libcurses: fix undefined behavior in test addch

The libcurses framework is not strictly typed and thus provides plenty
of ways to shoot yourself in the foot.  It's a waste of time debugging
things that a proper programming language can easily prevent.

The function addch expects an argument of type 'chtype'.  Passing a
"double-quoted" string does not match this, as 'chtype' is completely
different from a plain 'char'.  Instead, functions taking a 'chtype'
must be passed a `backtick-quoted` string.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libcurses/tests/addch

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



CVS commit: src/lib/libcurses

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 23:00:57 UTC 2021

Modified Files:
src/lib/libcurses: curses_screen.3

Log Message:
curses_screen.3: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/lib/libcurses/curses_screen.3

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/curses_screen.3
diff -u src/lib/libcurses/curses_screen.3:1.27 src/lib/libcurses/curses_screen.3:1.28
--- src/lib/libcurses/curses_screen.3:1.27	Sat Feb  6 13:58:09 2021
+++ src/lib/libcurses/curses_screen.3	Sun Feb  7 23:00:57 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: curses_screen.3,v 1.27 2021/02/06 13:58:09 rillig Exp $
+.\"	$NetBSD: curses_screen.3,v 1.28 2021/02/07 23:00:57 rillig Exp $
 .\"
 .\" Copyright (c) 2002
 .\"	Brett Lymn (bl...@netbsd.org, brett_l...@yahoo.com.au)
@@ -204,7 +204,7 @@ A subsequent call to
 .Fn initscr
 or
 .Fn newterm
-performs the following additonal actions:
+performs the following additional actions:
 .Bl -bullet -compact
 .It
 Disable use of clear, cud, cud1, cup, cuu, cuu1 and vpa.



CVS commit: src/lib/libcurses

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 23:00:57 UTC 2021

Modified Files:
src/lib/libcurses: curses_screen.3

Log Message:
curses_screen.3: fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/lib/libcurses/curses_screen.3

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 21:33:27 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: use a single message style for diagnostics

Previously, there were several concurring styles:

$msg in line %zu of file %s
$msg line %zu of file %s
%s, %zu: $msg

All these are now replaced with "%s:%zu: $msg".


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 21:33:27 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: use a single message style for diagnostics

Previously, there were several concurring styles:

$msg in line %zu of file %s
$msg line %zu of file %s
%s, %zu: $msg

All these are now replaced with "%s:%zu: $msg".


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.33 src/tests/lib/libcurses/director/testlang_parse.y:1.34
--- src/tests/lib/libcurses/director/testlang_parse.y:1.33	Sun Feb  7 20:48:07 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 21:33:27 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.33 2021/02/07 20:48:07 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.34 2021/02/07 21:33:27 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -198,7 +198,7 @@ extern saved_data_t saved_output;
 %%
 
 statements	: /* empty */
-		| statement eol statements
+		| statement EOL statements
 		;
 
 statement	: assign
@@ -290,8 +290,8 @@ check		: CHECK var returns {
 	var_t *vptr;
 
 	if (command.returns[0].data_index == -1)
-		err(1, "Undefined variable in check statement, line %zu"
-		" of file %s", line, cur_file);
+		err(1, "%s:%zu: Undefined variable in check statement",
+		cur_file, line);
 
 	if (command.returns[1].data_type == data_var) {
 		vptr = [command.returns[1].data_index];
@@ -315,8 +315,7 @@ check		: CHECK var returns {
 	if (((command.returns[1].data_type == data_byte) &&
 	 (vars[command.returns[0].data_index].type != data_byte)))
 		err(1, "Var type %s (%d) does not match return type %s (%d)",
-		enum_names[
-		vars[command.returns[0].data_index].type],
+		enum_names[vars[command.returns[0].data_index].type],
 		vars[command.returns[0].data_index].type,
 		enum_names[command.returns[1].data_type],
 		command.returns[1].data_type);
@@ -370,8 +369,7 @@ check		: CHECK var returns {
 		break;
 
 	default:
-		err(1, "Malformed check statement at line %zu "
-		"of file %s", line, cur_file);
+		err(1, "%s:%zu: Malformed check statement", cur_file, line);
 		break;
 	}
 
@@ -382,8 +380,8 @@ check		: CHECK var returns {
 delay		: DELAY numeric {
 	/* set the inter-character delay */
 	if (sscanf($2, "%d", _delay) == 0)
-		err(1, "delay specification %s could not be converted to "
-		"numeric at line %zu of file %s", $2, line, cur_file);
+		err(1, "%s:%zu: Delay specification %s must be an int",
+		cur_file, line, $2);
 	if (verbose) {
 		fprintf(stderr, "Set input delay to %d ms\n", input_delay);
 	}
@@ -409,8 +407,7 @@ delay		: DELAY numeric {
 
 input		: INPUT STRING {
 	if (input_str != NULL) {
-		warnx("%s, %zu: Discarding unused input string",
-		cur_file, line);
+		warnx("%s:%zu: Discarding unused input string", cur_file, line);
 		free(input_str);
 	}
 
@@ -424,8 +421,7 @@ input		: INPUT STRING {
 
 noinput		: NOINPUT {
 	if (input_str != NULL) {
-		warnx("%s, %zu: Discarding unused input string",
-		cur_file, line);
+		warnx("%s:%zu: Discarding unused input string", cur_file, line);
 		free(input_str);
 	}
 
@@ -582,9 +578,6 @@ arg		: LPAREN expr RPAREN {
 		}
 		;
 
-eol		: EOL
-		;
-
 %%
 
 static void
@@ -600,7 +593,7 @@ excess(const char *fname, size_t lineno,
 	if (strnvisx(dst, dstlen, data, datalen, VIS_WHITE | VIS_OCTAL) == -1)
 		err(1, "strnvisx");
 
-	warnx("%s, %zu: [%s] Excess %zu bytes%s [%s]",
+	warnx("%s:%zu: [%s] Excess %zu bytes%s [%s]",
 	fname, lineno, func, datalen, comment, dst);
 	free(dst);
 }
@@ -704,8 +697,8 @@ static wchar_t	*add_to_vals(data_enum_t 
 
 	case data_var:
 		if ((i = find_var_index((char *) arg)) < 0)
-			err(1, "Variable %s is undefined at line %zu "
-			"of file %s", (char *) arg, line, cur_file);
+			err(1, "%s:%zu: Variable %s is undefined",
+			cur_file, line, (const char *) arg);
 
 		switch (vars[i].type) {
 
@@ -716,17 +709,16 @@ static wchar_t	*add_to_vals(data_enum_t 
 			break;
 
 		default:
-			err(1, "Variable %s is not a valid type for cchar"
-			" at line %zu of file %s", (char *) arg, line,
-			cur_file);
+			err(1, "%s:%zu: Variable %s has invalid type for cchar",
+			cur_file, line, (const char *) arg);
 			break;
 
 		}
 		break;
 
 	default:
-		err(1, "add_to_vals: Unhandled type for vals array "
-		"at line %zu of file %s", line, cur_file);
+		err(1, "%s:%zu: Internal error: Unhandled type for vals array",
+		cur_file, line);
 
 		/* if we get here without a value then tidy up */
 		if ((nvals == 0) && (have_malloced == 1)) {
@@ -784,16 +776,16 @@ set_cchar(char *name, void *attributes)
 	

CVS commit: src/sys/arch/arm/cortex

2021-02-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  7 21:24:50 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: gicv3.c

Log Message:
Optimize hardware priority updates.

In gicv3_set_priority, read the current priority mask and only update it
if we are lowering the priority. The hardware priority filter is raised
only after taking an interrupt. This makes splfoo/splx without an interrupt
in between considerably cheaper as PMR writes are relatively expensive
compared to reads.

While here, avoid an extra daif read when dispatching interrupts by using
ENABLE_INTERRUPT() / DISABLE_INTERRUPT() instead of cpsie() / cpsid() macros.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/arm/cortex/gicv3.c

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



CVS commit: src/sys/arch/arm/cortex

2021-02-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  7 21:24:50 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: gicv3.c

Log Message:
Optimize hardware priority updates.

In gicv3_set_priority, read the current priority mask and only update it
if we are lowering the priority. The hardware priority filter is raised
only after taking an interrupt. This makes splfoo/splx without an interrupt
in between considerably cheaper as PMR writes are relatively expensive
compared to reads.

While here, avoid an extra daif read when dispatching interrupts by using
ENABLE_INTERRUPT() / DISABLE_INTERRUPT() instead of cpsie() / cpsid() macros.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/arm/cortex/gicv3.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gicv3.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.39 src/sys/arch/arm/cortex/gicv3.c:1.40
--- src/sys/arch/arm/cortex/gicv3.c:1.39	Sat Jan 16 21:05:15 2021
+++ src/sys/arch/arm/cortex/gicv3.c	Sun Feb  7 21:24:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.39 2021/01/16 21:05:15 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.40 2021/02/07 21:24:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -31,7 +31,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.39 2021/01/16 21:05:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.40 2021/02/07 21:24:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -220,8 +220,13 @@ static void
 gicv3_set_priority(struct pic_softc *pic, int ipl)
 {
 	struct gicv3_softc * const sc = PICTOSOFTC(pic);
+	const uint8_t curpmr = icc_pmr_read();
+	const uint8_t newpmr = IPL_TO_PMR(sc, ipl);
 
-	icc_pmr_write(IPL_TO_PMR(sc, ipl));
+	if (newpmr > curpmr) {
+		/* Lowering priority mask */
+		icc_pmr_write(newpmr);
+	}
 }
 
 static void
@@ -407,7 +412,7 @@ gicv3_cpu_init(struct pic_softc *pic, st
 		;
 
 	/* Set initial priority mask */
-	gicv3_set_priority(pic, IPL_HIGH);
+	icc_pmr_write(IPL_TO_PMR(sc, IPL_HIGH));
 
 	/* Set the binary point field to the minimum value */
 	icc_bpr1_write(0);
@@ -424,7 +429,7 @@ gicv3_cpu_init(struct pic_softc *pic, st
 	gicv3_redist_enable(sc, ci);
 
 	/* Allow IRQ exceptions */
-	cpsie(I32_bit);
+	ENABLE_INTERRUPT();
 }
 
 #ifdef MULTIPROCESSOR
@@ -722,9 +727,14 @@ gicv3_irq_handler(void *frame)
 	struct gicv3_softc * const sc = gicv3_softc;
 	struct pic_softc *pic;
 	const int oldipl = ci->ci_cpl;
+	const uint8_t pmr = IPL_TO_PMR(sc, oldipl);
 
 	ci->ci_data.cpu_nintr++;
 
+	if (icc_pmr_read() != pmr) {
+		icc_pmr_write(pmr);
+	}
+
 	for (;;) {
 		const uint32_t iar = icc_iar1_read();
 		dsb(sy);
@@ -745,7 +755,7 @@ gicv3_irq_handler(void *frame)
 		if (__predict_false(ipl < ci->ci_cpl)) {
 			pic_do_pending_ints(I32_bit, ipl, frame);
 		} else if (ci->ci_cpl != ipl) {
-			gicv3_set_priority(pic, ipl);
+			icc_pmr_write(IPL_TO_PMR(sc, ipl));
 			ci->ci_cpl = ipl;
 		}
 
@@ -756,9 +766,9 @@ gicv3_irq_handler(void *frame)
 
 		const int64_t nintr = ci->ci_data.cpu_nintr;
 
-		cpsie(I32_bit);
+		ENABLE_INTERRUPT();
 		pic_dispatch(is, frame);
-		cpsid(I32_bit);
+		DISABLE_INTERRUPT();
 
 		if (nintr != ci->ci_data.cpu_nintr)
 			ci->ci_intr_preempt.ev_count++;



CVS commit: src/sys/arch/arm/pic

2021-02-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  7 21:18:37 UTC 2021

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
Use ENABLE_INTERRUPT() / DISABLE_INTERRUPT() instead of cpsie()/cpsid() in
places where we don't care about the cpsie() return value.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/arm/pic/pic.c

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

Modified files:

Index: src/sys/arch/arm/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.61 src/sys/arch/arm/pic/pic.c:1.62
--- src/sys/arch/arm/pic/pic.c:1.61	Sun Nov  1 14:42:05 2020
+++ src/sys/arch/arm/pic/pic.c	Sun Feb  7 21:18:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.61 2020/11/01 14:42:05 jmcneill Exp $	*/
+/*	$NetBSD: pic.c,v 1.62 2021/02/07 21:18:37 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.61 2020/11/01 14:42:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.62 2021/02/07 21:18:37 jmcneill Exp $");
 
 #include 
 #include 
@@ -447,13 +447,14 @@ pic_deliver_irqs(struct pic_pending *pen
 			atomic_and_32(ipending, ~__BIT(irq));
 			is = pic->pic_sources[irq_base + irq];
 			if (is != NULL) {
-cpsie(I32_bit);
+ENABLE_INTERRUPT();
 pic_dispatch(is, frame);
-cpsid(I32_bit);
+DISABLE_INTERRUPT();
 #if PIC_MAXSOURCES > 32
 /*
  * There is a possibility of interrupting
- * from cpsie() to cpsid().
+ * from ENABLE_INTERRUPT() to
+ * DISABLE_INTERRUPT().
  */
 poi = 1;
 #endif



CVS commit: src/sys/arch/arm/pic

2021-02-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  7 21:18:37 UTC 2021

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
Use ENABLE_INTERRUPT() / DISABLE_INTERRUPT() instead of cpsie()/cpsid() in
places where we don't care about the cpsie() return value.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/arm/pic/pic.c

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



CVS commit: src/sys/arch/arm/include

2021-02-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  7 21:15:41 UTC 2021

Modified Files:
src/sys/arch/arm/include: cpufunc.h

Log Message:
Add ENABLE_INTERRUPT() / DISABLE_INTERRUPT() macros for compatibility
with aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/arm/include/cpufunc.h

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



CVS commit: src/sys/arch/arm/include

2021-02-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  7 21:15:41 UTC 2021

Modified Files:
src/sys/arch/arm/include: cpufunc.h

Log Message:
Add ENABLE_INTERRUPT() / DISABLE_INTERRUPT() macros for compatibility
with aarch64.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/arm/include/cpufunc.h

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

Modified files:

Index: src/sys/arch/arm/include/cpufunc.h
diff -u src/sys/arch/arm/include/cpufunc.h:1.86 src/sys/arch/arm/include/cpufunc.h:1.87
--- src/sys/arch/arm/include/cpufunc.h:1.86	Thu Dec  3 07:45:52 2020
+++ src/sys/arch/arm/include/cpufunc.h	Sun Feb  7 21:15:40 2021
@@ -353,6 +353,9 @@ enable_interrupts(uint32_t mask)
 #define restore_interrupts(old_cpsr)	\
 	(__set_cpsr_c((I32_bit | F32_bit), (old_cpsr) & (I32_bit | F32_bit)))
 
+#define	ENABLE_INTERRUPT()	cpsie(I32_bit)
+#define	DISABLE_INTERRUPT()	cpsid(I32_bit)
+
 static inline void cpsie(register_t psw) __attribute__((__unused__));
 static inline register_t cpsid(register_t psw) __attribute__((__unused__));
 



CVS commit: src/sys/arch/aarch64/include

2021-02-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  7 21:15:09 UTC 2021

Modified Files:
src/sys/arch/aarch64/include: locore.h

Log Message:
Use reg_daif{set,clr}_write directly instead of daif_{en,dis}able for
ENABLE_INTERRUPT() and DISABLE_INTERRUPT() macros, to avoid an unnecessary
reg_daif_read().


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/include/locore.h

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



CVS commit: src/sys/arch/aarch64/include

2021-02-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb  7 21:15:09 UTC 2021

Modified Files:
src/sys/arch/aarch64/include: locore.h

Log Message:
Use reg_daif{set,clr}_write directly instead of daif_{en,dis}able for
ENABLE_INTERRUPT() and DISABLE_INTERRUPT() macros, to avoid an unnecessary
reg_daif_read().


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/include/locore.h

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

Modified files:

Index: src/sys/arch/aarch64/include/locore.h
diff -u src/sys/arch/aarch64/include/locore.h:1.6 src/sys/arch/aarch64/include/locore.h:1.7
--- src/sys/arch/aarch64/include/locore.h:1.6	Fri Oct 30 18:54:35 2020
+++ src/sys/arch/aarch64/include/locore.h	Sun Feb  7 21:15:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.6 2020/10/30 18:54:35 skrll Exp $ */
+/* $NetBSD: locore.h,v 1.7 2021/02/07 21:15:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -59,8 +59,10 @@
 #define cpsid(psw)		daif_disable((psw))
 
 
-#define ENABLE_INTERRUPT()	daif_enable(DAIF_I|DAIF_F)
-#define DISABLE_INTERRUPT()	daif_disable(DAIF_I|DAIF_F)
+#define ENABLE_INTERRUPT()	\
+	reg_daifclr_write((DAIF_I|DAIF_F) >> DAIF_SETCLR_SHIFT)
+#define DISABLE_INTERRUPT()	\
+	reg_daifset_write((DAIF_I|DAIF_F) >> DAIF_SETCLR_SHIFT)
 
 #define DAIF_MASK		(DAIF_D|DAIF_A|DAIF_I|DAIF_F)
 



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 20:48:07 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: make grammar for test cases conflict-free

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 20:48:07 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: make grammar for test cases conflict-free

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.32 src/tests/lib/libcurses/director/testlang_parse.y:1.33
--- src/tests/lib/libcurses/director/testlang_parse.y:1.32	Sun Feb  7 20:40:05 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 20:48:07 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.32 2021/02/07 20:40:05 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.33 2021/02/07 20:48:07 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -253,7 +253,7 @@ attributes	: numeric
 char_vals	: numeric {
 			add_to_vals(data_number, $1);
 		}
-		| LBRACK array RBRACK
+		| LBRACK array_elements RBRACK
 		| VARIABLE {
 			add_to_vals(data_var, $1);
 		}
@@ -485,10 +485,13 @@ fn_name		: VARNAME {
 		}
 		;
 
-array		: numeric {
+array_elements	: array_element
+		| array_element COMMA array_elements
+		;
+
+array_element	: numeric {
 			$$ = add_to_vals(data_number, $1);
 		}
-		; /* XXX: extra semicolon; yacc seems to ignore this. */
 		| VARIABLE {
 			$$ = add_to_vals(data_number,
 			get_numeric_var($1));
@@ -535,7 +538,6 @@ array		: numeric {
 (void *) $1);
 			}
 		}
-		| array COMMA array
 		;
 
 expr		: numeric



CVS commit: src/tests/lib/libcurses

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 20:40:06 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l testlang_parse.y
src/tests/lib/libcurses/tests: keyname

Log Message:
tests/libcurses: fix grammar for arrays

Previously, commas were completely ignored by the grammar.  Erroring out
on invalid characters made some of the tests fail since the comma was
not recognized anymore.  Add it back, but only for defining arrays.  It
would have been possible to leave out the commas or make them optional,
but since the current tests do not make use of that, keep the grammar as
strict as possible.

Fix an unclosed string literal in a test.  This had been wrongly
accepted before by the grammar.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libcurses/director/testlang_conf.l
cvs rdiff -u -r1.31 -r1.32 src/tests/lib/libcurses/director/testlang_parse.y
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libcurses/tests/keyname

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



CVS commit: src/tests/lib/libcurses

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 20:40:06 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l testlang_parse.y
src/tests/lib/libcurses/tests: keyname

Log Message:
tests/libcurses: fix grammar for arrays

Previously, commas were completely ignored by the grammar.  Erroring out
on invalid characters made some of the tests fail since the comma was
not recognized anymore.  Add it back, but only for defining arrays.  It
would have been possible to leave out the commas or make them optional,
but since the current tests do not make use of that, keep the grammar as
strict as possible.

Fix an unclosed string literal in a test.  This had been wrongly
accepted before by the grammar.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libcurses/director/testlang_conf.l
cvs rdiff -u -r1.31 -r1.32 src/tests/lib/libcurses/director/testlang_parse.y
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libcurses/tests/keyname

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.15 src/tests/lib/libcurses/director/testlang_conf.l:1.16
--- src/tests/lib/libcurses/director/testlang_conf.l:1.15	Sun Feb  7 20:32:25 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l	Sun Feb  7 20:40:05 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.15 2021/02/07 20:32:25 rillig Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.16 2021/02/07 20:40:05 rillig Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -164,6 +164,7 @@ RPAREN		\)
 LBRACK		\[
 RBRACK		\]
 MULTIPLIER	\*
+COMMA		,
 
 %x incl
 %option noinput nounput
@@ -245,6 +246,7 @@ include		BEGIN(incl);
 {OK_RET}	return OK_RET;
 {ERR_RET}	return ERR_RET;
 {MULTIPLIER}	return MULTIPLIER;
+{COMMA}		return COMMA;
 {CCHAR}		return CCHAR;
 {WCHAR}		return WCHAR;
 {OR}		return OR;

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.31 src/tests/lib/libcurses/director/testlang_parse.y:1.32
--- src/tests/lib/libcurses/director/testlang_parse.y:1.31	Sun Feb  7 19:44:34 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 20:40:05 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.31 2021/02/07 19:44:34 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.32 2021/02/07 20:40:05 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -190,6 +190,7 @@ extern saved_data_t saved_output;
 %token  CCHAR
 %token  WCHAR
 %token EOL CALL CHECK NOINPUT OR MULTIPLIER LPAREN RPAREN LBRACK RBRACK
+%token COMMA
 %token CALL2 CALL3 CALL4 DRAIN
 
 %nonassoc OR
@@ -534,7 +535,7 @@ array		: numeric {
 (void *) $1);
 			}
 		}
-		| array array
+		| array COMMA array
 		;
 
 expr		: numeric

Index: src/tests/lib/libcurses/tests/keyname
diff -u src/tests/lib/libcurses/tests/keyname:1.2 src/tests/lib/libcurses/tests/keyname:1.3
--- src/tests/lib/libcurses/tests/keyname:1.2	Sat Oct 24 04:46:17 2020
+++ src/tests/lib/libcurses/tests/keyname	Sun Feb  7 20:40:06 2021
@@ -3,7 +3,7 @@ call "^C" keyname 0x03
 call "C" keyname 0x43
 call "^?" keyname 0x7f
 call "M-^C" keyname 0x83
-call "M-C" keyname "0xc3
+call "M-C" keyname 0xc3
 call "M-^?" keyname 0xff
 call "KEY_RIGHT" keyname $KEY_RIGHT
 call "UNKNOWN KEY" keyname 0x205



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 20:32:25 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
tests/libcurses: do not allow control characters in paths


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libcurses/director/testlang_conf.l

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.14 src/tests/lib/libcurses/director/testlang_conf.l:1.15
--- src/tests/lib/libcurses/director/testlang_conf.l:1.14	Sun Feb  7 20:27:40 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l	Sun Feb  7 20:32:25 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.14 2021/02/07 20:27:40 rillig Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.15 2021/02/07 20:32:25 rillig Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -137,7 +137,7 @@ dequote(const char *s, size_t *len)
 HEX		0[xX][0-9a-zA-Z]+
 STRING		[0-9a-z!#-&(-^ \t%._\\]+
 numeric		[-0-9]+
-PCHAR   (\\.|[^ \t\n])
+PCHAR   (\\.|[!-~])
 ASSIGN		assign
 CALL2		call2
 CALL3		call3



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 20:32:25 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
tests/libcurses: do not allow control characters in paths


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libcurses/director/testlang_conf.l

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 20:27:40 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
tests/libcurses: error out on trying to parse /dev/zero

Be strict when parsing the tests.  Any unknown character is an error.
This avoids an endless loop when running "./director /dev/zero".  There
is no point in silently ignoring other invalid characters as well, as
this would only leave potential test writers in an unclear state,
without any benefit.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libcurses/director/testlang_conf.l

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.13 src/tests/lib/libcurses/director/testlang_conf.l:1.14
--- src/tests/lib/libcurses/director/testlang_conf.l:1.13	Sun Feb  7 19:49:32 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l	Sun Feb  7 20:27:40 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.13 2021/02/07 19:49:32 rillig Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.14 2021/02/07 20:27:40 rillig Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -380,7 +380,12 @@ include		BEGIN(incl);
 		}
 
 .		{
-			/* FIXME: report syntax error */
+			if (isprint((unsigned char)yytext[0]))
+errx(1, "%s:%zu: Invalid character '%c'",
+cur_file, line + 1, yytext[0]);
+			else
+errx(1, "%s:%zu: Invalid character '0x%02x'",
+cur_file, line + 1, yytext[0]);
 		}
 
 %%



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 20:27:40 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l

Log Message:
tests/libcurses: error out on trying to parse /dev/zero

Be strict when parsing the tests.  Any unknown character is an error.
This avoids an endless loop when running "./director /dev/zero".  There
is no point in silently ignoring other invalid characters as well, as
this would only leave potential test writers in an unclear state,
without any benefit.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libcurses/director/testlang_conf.l

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



CVS commit: src/tests/lib/libcurses

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 20:20:06 UTC 2021

Modified Files:
src/tests/lib/libcurses: testframe.txt

Log Message:
tests/libcurses: fix documentation of call[234]

The function getyx is not a function but a macro.  It does not return
int, but void.  Since these changes destroy the simplicity of the
example, combining a regular return value and pass-by-reference return
values, I rewrote the whole section and added more examples.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libcurses/testframe.txt

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

Modified files:

Index: src/tests/lib/libcurses/testframe.txt
diff -u src/tests/lib/libcurses/testframe.txt:1.6 src/tests/lib/libcurses/testframe.txt:1.7
--- src/tests/lib/libcurses/testframe.txt:1.6	Sat Feb  6 20:09:43 2021
+++ src/tests/lib/libcurses/testframe.txt	Sun Feb  7 20:20:06 2021
@@ -1,4 +1,4 @@
-$NetBSD: testframe.txt,v 1.6 2021/02/06 20:09:43 rillig Exp $
+$NetBSD: testframe.txt,v 1.7 2021/02/07 20:20:06 rillig Exp $
 
 CURSES TESTFRAME
 
@@ -63,29 +63,47 @@ assign:
   overwritten on each subsequent use.
 
 call, call2, call3, call4:
-  All these are used to call curses routines, the only difference
-  between then is the number of expected return values.  Call
+
+  All these are used to call curses routines.  The only difference
+  between them is the number of expected return values.  Call
   expects one return value, call2 expects 2, call3 expects 3 and
-  call4 expects four.  Any parameters that are passed by reference
-  and updated by the call are treated like returns.  So, for
-  example, calling the function getyx() which has three
-  parameters, the window, a pointer to storage for y and a pointer
-  to storage for x would be called like this:
-
-  	 	 call3 OK 4 5 getyx $win1
-
-  Which calls getyx, the first (and possibly only) return is the
-  return status of the function call, in this case we expect "OK"
-  indicating that the call succeeded.  The next two returns are
-  the values of y and x respectively, the parameter $win1 is a
-  variable that was assigned by a previous call.  Any return can
-  be assigned to a variable by including the variable name in a
-  call return list.  Variables are referenced in a call parameter
-  list by prefixing the name with a $ character.  All returns are
-  validated against the expected values and an error raised if
-  there is a mismatch.  The only exception to this is when the
-  return is assigned to a variable.  Valid values for the returns
-  list are:
+  call4 expects 4.  Any parameters that are passed by reference and
+  updated by the call are treated like returns and are listed after
+  the regular return value.  The general form of a call is:
+
+		call[234]   
+
+  As an example, the macro 'getyx' has 3 parameters, as seen by a C
+  programmer, and it has return type 'void'.  If its return type
+  were not void, that would be its first return value.  The first
+  parameter is a window and is passed by value.  The other two, 'y'
+  and 'x' are references to return values, thus they do not count as
+  parameters.  In summary, there are 2 return values, therefore
+  'call2' is used:
+
+		call2	4 5	getyx		$win1
+
+  The two return values from the actual function call are validated
+  to be '4' and '5'.  The parameter '$win' refers to a variable that
+  has been defined by a previous call or variable assignment.
+
+  Instead of directly validating the return values, they can also be
+  assigned to variables:
+
+		call2	y x	getyx		$win1
+		check	y 4
+		check	x 5
+
+  Another example is 'mvwaddwstr', which has a single return value
+  (OK or ERR) and 4 parameters.  It is called like this:
+
+		call	OK	mvwaddwstr	$win1 4 5 "text"
+
+  Variables are referenced in a call parameter list by prefixing the
+  name with a '$' sign.  All returns are validated against the
+  expected values and an error raised if there is a mismatch.  The
+  only exception to this is when the return is assigned to a
+  variable.  Valid values for the returns list are:
 
   	  	  variable - assign the return to the given variable
 		 name.



CVS commit: src/tests/lib/libcurses

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 20:20:06 UTC 2021

Modified Files:
src/tests/lib/libcurses: testframe.txt

Log Message:
tests/libcurses: fix documentation of call[234]

The function getyx is not a function but a macro.  It does not return
int, but void.  Since these changes destroy the simplicity of the
example, combining a regular return value and pass-by-reference return
values, I rewrote the whole section and added more examples.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libcurses/testframe.txt

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



CVS commit: src/tests/lib/libcurses

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 19:49:32 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l
src/tests/lib/libcurses/tests: innstr

Log Message:
tests/libcurses: require keywords to be lowercase, except for OK and ERR

There is no need to write the keywords in upper case or mixed case.  The
only case where a keyword did not have the canonical form yet was a
single lowercase 'ok' in the test case 'innstr'.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libcurses/director/testlang_conf.l
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/tests/innstr

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.12 src/tests/lib/libcurses/director/testlang_conf.l:1.13
--- src/tests/lib/libcurses/director/testlang_conf.l:1.12	Sun Feb  7 17:32:55 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l	Sun Feb  7 19:49:32 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.12 2021/02/07 17:32:55 rillig Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.13 2021/02/07 19:49:32 rillig Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -138,25 +138,25 @@ HEX		0[xX][0-9a-zA-Z]+
 STRING		[0-9a-z!#-&(-^ \t%._\\]+
 numeric		[-0-9]+
 PCHAR   (\\.|[^ \t\n])
-ASSIGN		[aA][sS][sS][iI][gG][nN]
-CALL2		[cC][aA][lL][lL]2
-CALL3		[cC][aA][lL][lL]3
-CALL4		[cC][aA][lL][lL]4
-CALL		[cC][aA][lL][lL]
-CHECK		[cC][hH][eE][cC][kK]
-DELAY		[dD][eE][lL][aA][yY]
-INPUT		[iI][nN][pP][uU][tT]
-NOINPUT		[nN][oO][iI][nN][pP][uU][tT]
-OK_RET		[oO][kK]
-ERR_RET		[eE][rR][rR]
-COMPARE		[cC][oO][mM][pP][aA][rR][eE]
-COMPAREND	[cC][oO][mM][pP][aA][rR][eE][Nn][Dd]
+ASSIGN		assign
+CALL2		call2
+CALL3		call3
+CALL4		call4
+CALL		call
+CHECK		check
+DELAY		delay
+INPUT		input
+NOINPUT		noinput
+OK_RET		OK
+ERR_RET		ERR
+COMPARE		compare
+COMPAREND	comparend
 FILENAME	[A-Za-z0-9.][A-Za-z0-9./_-]+
 VARNAME		[A-Za-z][A-Za-z0-9_-]+
 NULL_RET	NULL
 NON_NULL	NON_NULL
-CCHAR		[cC][cC][hH][aA][rR]
-WCHAR		[wW][cC][hH][aA][rR]
+CCHAR		cchar
+WCHAR		wchar
 BYTE		BYTE
 OR		\|
 LPAREN		\(

Index: src/tests/lib/libcurses/tests/innstr
diff -u src/tests/lib/libcurses/tests/innstr:1.1 src/tests/lib/libcurses/tests/innstr:1.2
--- src/tests/lib/libcurses/tests/innstr:1.1	Sun May 26 09:54:33 2019
+++ src/tests/lib/libcurses/tests/innstr	Sun Feb  7 19:49:32 2021
@@ -3,6 +3,6 @@ call OK move 0 2
 call2 5 "cdefg" innstr 6
 call OK move 0 76
 call OK addstr "123"
-call ok move 0 75
+call OK move 0 75
 call2 5 " 123 " innstr 10
 call2 OK " 123 " instr



CVS commit: src/tests/lib/libcurses

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 19:49:32 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l
src/tests/lib/libcurses/tests: innstr

Log Message:
tests/libcurses: require keywords to be lowercase, except for OK and ERR

There is no need to write the keywords in upper case or mixed case.  The
only case where a keyword did not have the canonical form yet was a
single lowercase 'ok' in the test case 'innstr'.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libcurses/director/testlang_conf.l
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/tests/innstr

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 19:44:34 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: add missing semicolon in grammar


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 19:44:34 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: add missing semicolon in grammar


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.30 src/tests/lib/libcurses/director/testlang_parse.y:1.31
--- src/tests/lib/libcurses/director/testlang_parse.y:1.30	Sun Feb  7 18:32:20 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 19:44:34 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.30 2021/02/07 18:32:20 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.31 2021/02/07 19:44:34 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -471,7 +471,7 @@ var		: VARNAME {
 reference	: VARIABLE {
 			assign_rets(data_ref, $1);
 		}
-		/* XXX: missing semicolon; how does yacc interpret this? */
+		;
 
 fn_name		: VARNAME {
 			if (command.function != NULL)



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 19:28:07 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: returns.h

Log Message:
tests/libcurses: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcurses/director/returns.h

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 19:28:07 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: returns.h

Log Message:
tests/libcurses: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcurses/director/returns.h

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

Modified files:

Index: src/tests/lib/libcurses/director/returns.h
diff -u src/tests/lib/libcurses/director/returns.h:1.3 src/tests/lib/libcurses/director/returns.h:1.4
--- src/tests/lib/libcurses/director/returns.h:1.3	Sat Oct 24 04:46:17 2020
+++ src/tests/lib/libcurses/director/returns.h	Sun Feb  7 19:28:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: returns.h,v 1.3 2020/10/24 04:46:17 blymn Exp $	*/
+/*	$NetBSD: returns.h,v 1.4 2021/02/07 19:28:07 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -51,7 +51,7 @@ typedef enum {
 
 typedef struct {
 	data_enum_t	data_type;
-	void		*data_value;	/* used if data_type is data_num or
+	void		*data_value;	/* used if data_type is data_num
 	   or data_byte or data_string */
 	size_t		data_len;	/* number of bytes in return_value iff
 	   return_type is data_byte */



CVS commit: src/tests/lib/libcurses/check_files

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 18:56:37 UTC 2021

Modified Files:
src/tests/lib/libcurses/check_files: addchstr2.chk

Log Message:
tests/libcurses: fix expected test output

The test framework doesn't check the files strictly, it only checks
whether the expected output is a prefix of the actual output, or vice
versa.  This allows several deviations to pass unnoticed, which is
wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/check_files/addchstr2.chk

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

Modified files:

Index: src/tests/lib/libcurses/check_files/addchstr2.chk
diff -u src/tests/lib/libcurses/check_files/addchstr2.chk:1.1 src/tests/lib/libcurses/check_files/addchstr2.chk:1.2
--- src/tests/lib/libcurses/check_files/addchstr2.chk:1.1	Sun May 26 09:54:33 2019
+++ src/tests/lib/libcurses/check_files/addchstr2.chk	Sun Feb  7 18:56:37 2021
@@ -1 +1 @@
-smulrevfghrmulsgr0
+smulrevfghrmulsgr0
\ No newline at end of file



CVS commit: src/tests/lib/libcurses/check_files

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 18:56:37 UTC 2021

Modified Files:
src/tests/lib/libcurses/check_files: addchstr2.chk

Log Message:
tests/libcurses: fix expected test output

The test framework doesn't check the files strictly, it only checks
whether the expected output is a prefix of the actual output, or vice
versa.  This allows several deviations to pass unnoticed, which is
wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/check_files/addchstr2.chk

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 18:32:20 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: add const to some function parameters


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.29 src/tests/lib/libcurses/director/testlang_parse.y:1.30
--- src/tests/lib/libcurses/director/testlang_parse.y:1.29	Sun Feb  7 18:14:43 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 18:32:20 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.29 2021/02/07 18:14:43 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.30 2021/02/07 18:32:20 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -124,7 +124,7 @@ static var_t *vars; 		/* Variables defin
 static int	check_function_table(char *, const char *[], int);
 static int	find_var_index(const char *);
 static void 	assign_arg(data_enum_t, void *);
-static int	assign_var(char *);
+static int	assign_var(const char *);
 void		init_parse_variables(int);
 static void	validate(int, void *);
 static void	validate_return(const char *, const char *, int);
@@ -136,11 +136,11 @@ static void	write_cmd_pipe(char *);
 static void	write_cmd_pipe_args(data_enum_t, void *);
 static void	read_cmd_pipe(ct_data_t *);
 static void	write_func_and_args(void);
-static void	compare_streams(char *, bool);
+static void	compare_streams(const char *, bool);
 static void	do_function_call(size_t);
 static void	save_slave_output(bool);
 static void	validate_type(data_enum_t, ct_data_t *, int);
-static void	set_var(data_enum_t, char *, void *);
+static void	set_var(data_enum_t, const char *, void *);
 static void	validate_reference(int, void *);
 static char *	numeric_or(char *, char *);
 static char *	get_numeric_var(const char *);
@@ -741,7 +741,7 @@ static wchar_t	*add_to_vals(data_enum_t 
  * Assign the value given to the named variable.
  */
 static void
-set_var(data_enum_t type, char *name, void *value)
+set_var(data_enum_t type, const char *name, void *value)
 {
 	int i;
 	char *number;
@@ -836,7 +836,7 @@ set_wchar(char *name)
  * when a test function call returns.
  */
 static int
-assign_var(char *varname)
+assign_var(const char *varname)
 {
 	var_t *temp;
 	char *name;
@@ -998,7 +998,7 @@ static int check_function_table(char *fu
  * any differences.
  */
 static void
-compare_streams(char *filename, bool discard)
+compare_streams(const char *filename, bool discard)
 {
 	char check_file[PATH_MAX], drain[100], ref, data;
 	struct pollfd fds[2];



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 18:32:20 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: add const to some function parameters


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/lib/libc/sys

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 18:22:51 UTC 2021

Modified Files:
src/lib/libc/sys: poll.2

Log Message:
poll.2: fix typo in manual page


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/sys/poll.2

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

Modified files:

Index: src/lib/libc/sys/poll.2
diff -u src/lib/libc/sys/poll.2:1.32 src/lib/libc/sys/poll.2:1.33
--- src/lib/libc/sys/poll.2:1.32	Fri Jul 17 18:58:11 2020
+++ src/lib/libc/sys/poll.2	Sun Feb  7 18:22:51 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: poll.2,v 1.32 2020/07/17 18:58:11 wiz Exp $
+.\"	$NetBSD: poll.2,v 1.33 2021/02/07 18:22:51 rillig Exp $
 .\"
 .\" Copyright (c) 1998, 2005, 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -221,7 +221,7 @@ This behaviour is believed to be more us
 .Pp
 The
 .Fn ppoll
-function is an wrapper for
+function is a wrapper for
 .Fn pollts
 to provide compatiblity with the Linux implementation.
 .Sh ERRORS



CVS commit: src/lib/libc/sys

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 18:22:51 UTC 2021

Modified Files:
src/lib/libc/sys: poll.2

Log Message:
poll.2: fix typo in manual page


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/sys/poll.2

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 18:14:44 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: simplify code for writing to the .exp file

If a write(2) returns less than 1, it must be an error.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.28 src/tests/lib/libcurses/director/testlang_parse.y:1.29
--- src/tests/lib/libcurses/director/testlang_parse.y:1.28	Sun Feb  7 17:50:16 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 18:14:43 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.28 2021/02/07 17:50:16 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.29 2021/02/07 18:14:43 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -1092,14 +1092,9 @@ compare_streams(char *filename, bool dis
 		}
 
 		if (create_check_file) {
-			if ((result = write(check_fd, , 1)) < 1) {
-if (result != 0) {
-	err(2,
-		"Bad write on file %s", check_file);
-}
-			}
-			else
-ref = data;
+			if ((result = write(check_fd, , 1)) < 1)
+err(2, "Bad write on file %s", check_file);
+			ref = data;
 		}
 
 		if (verbose) {



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 18:14:44 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: simplify code for writing to the .exp file

If a write(2) returns less than 1, it must be an error.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 17:50:16 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: actually compare the stream to an absolute path

Up to now, the test command "compare /dev/null" was a no-op since the
command was only parsed but not run at all.  Now run it.

This makes the test mvwin fail.  That test will have to be fixed.

Comparing to /dev/null is certainly possible and may make sense,
comparing to /dev/zero is nonsense since the actual stream can never be
endless.  Some tests do that nevertheless, for whatever reason.

In order to have the expected test output closer to the curses commands
that cause it, it may be a good idea to add another command
'compare_str' that would work independently of an external file and at
the same time allow the expected output to be commented and explained.
This is not possible right now since the .chk files are read exactly
as-is.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.27 src/tests/lib/libcurses/director/testlang_parse.y:1.28
--- src/tests/lib/libcurses/director/testlang_parse.y:1.27	Sun Feb  7 17:32:55 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 17:50:16 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.27 2021/02/07 17:32:55 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.28 2021/02/07 17:50:16 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -431,15 +431,17 @@ noinput		: NOINPUT {
 	no_input = true;
 }
 
-compare		: COMPARE PATH
-			/* FIXME: missing action */
+compare		: COMPARE PATH {
+			compare_streams($2, true);
+		}
 		| COMPARE FILENAME {
 			compare_streams($2, true);
 		}
 		;
 
-comparend	: COMPAREND PATH
-			/* FIXME: missing action */
+comparend	: COMPAREND PATH {
+			compare_streams($2, false);
+		}
 		| COMPAREND FILENAME {
 			compare_streams($2, false);
 		}
@@ -544,7 +546,6 @@ expr		: numeric
 		}
 		;
 
-		/* TODO: split into 'arg' */
 args		: /* empty */
 		| arg args
 		;



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 17:50:16 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: actually compare the stream to an absolute path

Up to now, the test command "compare /dev/null" was a no-op since the
command was only parsed but not run at all.  Now run it.

This makes the test mvwin fail.  That test will have to be fixed.

Comparing to /dev/null is certainly possible and may make sense,
comparing to /dev/zero is nonsense since the actual stream can never be
endless.  Some tests do that nevertheless, for whatever reason.

In order to have the expected test output closer to the curses commands
that cause it, it may be a good idea to add another command
'compare_str' that would work independently of an external file and at
the same time allow the expected output to be commented and explained.
This is not possible right now since the .chk files are read exactly
as-is.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: [netbsd-9] src/doc

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 17:42:35 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.2

Log Message:
Ticket #1198


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.42 -r1.1.2.43 src/doc/CHANGES-9.2

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

Modified files:

Index: src/doc/CHANGES-9.2
diff -u src/doc/CHANGES-9.2:1.1.2.42 src/doc/CHANGES-9.2:1.1.2.43
--- src/doc/CHANGES-9.2:1.1.2.42	Sun Feb  7 16:43:30 2021
+++ src/doc/CHANGES-9.2	Sun Feb  7 17:42:35 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.42 2021/02/07 16:43:30 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.43 2021/02/07 17:42:35 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1494,3 +1494,8 @@ usr.sbin/isibootd/isibootd.c			1.4
 	Fix isibootd(8) "Cannot allocate memory" failure on amd64.
 	[tsutsui, ticket #1200]
 
+lib/libc/stdio/fread.c1.24 (patch)
+
+	PR 55808: optimize buffer handling for unbuffered I/O.
+	[jdolecek, ticket #1198]
+



CVS commit: [netbsd-9] src/doc

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 17:42:35 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.2

Log Message:
Ticket #1198


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.42 -r1.1.2.43 src/doc/CHANGES-9.2

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



CVS commit: [netbsd-9] src/lib/libc/stdio

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 17:41:02 UTC 2021

Modified Files:
src/lib/libc/stdio [netbsd-9]: fread.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #1198):

lib/libc/stdio/fread.c: revision 1.24 (via patch)

for unbuffered I/O arrange for the destination buffer to be filled in one
go, instead of triggering long series of 1 byte read(2)s; this speeds up
fread() several order of magnitudes for this case, directly proportional
to the size of the supplied buffer
change adapted from OpenBSD rev. 1.19

fixes PR lib/55808 by Roland Illig


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.34.1 src/lib/libc/stdio/fread.c

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



CVS commit: [netbsd-9] src/lib/libc/stdio

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 17:41:02 UTC 2021

Modified Files:
src/lib/libc/stdio [netbsd-9]: fread.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #1198):

lib/libc/stdio/fread.c: revision 1.24 (via patch)

for unbuffered I/O arrange for the destination buffer to be filled in one
go, instead of triggering long series of 1 byte read(2)s; this speeds up
fread() several order of magnitudes for this case, directly proportional
to the size of the supplied buffer
change adapted from OpenBSD rev. 1.19

fixes PR lib/55808 by Roland Illig


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.34.1 src/lib/libc/stdio/fread.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/libc/stdio/fread.c
diff -u src/lib/libc/stdio/fread.c:1.22 src/lib/libc/stdio/fread.c:1.22.34.1
--- src/lib/libc/stdio/fread.c:1.22	Thu Mar 15 18:22:30 2012
+++ src/lib/libc/stdio/fread.c	Sun Feb  7 17:41:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fread.c,v 1.22 2012/03/15 18:22:30 christos Exp $	*/
+/*	$NetBSD: fread.c,v 1.22.34.1 2021/02/07 17:41:02 martin Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)fread.c	8.2 (Berkeley) 12/11/93";
 #else
-__RCSID("$NetBSD: fread.c,v 1.22 2012/03/15 18:22:30 christos Exp $");
+__RCSID("$NetBSD: fread.c,v 1.22.34.1 2021/02/07 17:41:02 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -72,6 +72,36 @@ fread(void *buf, size_t size, size_t cou
 		fp->_r = 0;
 	total = resid;
 	p = buf;
+
+	/*
+	 * If we're unbuffered we know that the buffer in fp is empty so
+	 * we can read directly into buf.  This is much faster than a
+	 * series of one byte reads into fp->_nbuf.
+	 */
+	if ((fp->_flags & __SNBF) != 0) {
+		while (resid > 0) {
+			/* set up the buffer */
+			fp->_bf._base = fp->_p = (unsigned char *)p;
+			fp->_bf._size = resid;
+
+			if (__srefill(fp)) {
+/* no more input: return partial result */
+count = (total - resid) / size;
+break;
+			}
+			p += fp->_r;
+			resid -= fp->_r;
+		}
+
+		/* restore the old buffer (see __smakebuf) */
+		fp->_bf._base = fp->_p = fp->_nbuf;
+		fp->_bf._size = 1;
+		fp->_r = 0;
+
+		FUNLOCKFILE(fp);
+		return (count);
+	}
+
 	while (resid > (size_t)(r = fp->_r)) {
 		(void)memcpy(p, fp->_p, (size_t)r);
 		fp->_p += r;



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 17:32:55 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l testlang_parse.y

Log Message:
tests/libcurses: use more common abbreviations for tokens


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libcurses/director/testlang_conf.l
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 17:32:55 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_conf.l testlang_parse.y

Log Message:
tests/libcurses: use more common abbreviations for tokens


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libcurses/director/testlang_conf.l
cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_conf.l
diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.11 src/tests/lib/libcurses/director/testlang_conf.l:1.12
--- src/tests/lib/libcurses/director/testlang_conf.l:1.11	Sun Feb  7 12:05:36 2021
+++ src/tests/lib/libcurses/director/testlang_conf.l	Sun Feb  7 17:32:55 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_conf.l,v 1.11 2021/02/07 12:05:36 rillig Exp $ 	*/
+/*	$NetBSD: testlang_conf.l,v 1.12 2021/02/07 17:32:55 rillig Exp $ 	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -159,10 +159,10 @@ CCHAR		[cC][cC][hH][aA][rR]
 WCHAR		[wW][cC][hH][aA][rR]
 BYTE		BYTE
 OR		\|
-LHB		\(
-RHB		\)
-LHSB		\[
-RHSB		\]
+LPAREN		\(
+RPAREN		\)
+LBRACK		\[
+RBRACK		\]
 MULTIPLIER	\*
 
 %x incl
@@ -248,10 +248,10 @@ include		BEGIN(incl);
 {CCHAR}		return CCHAR;
 {WCHAR}		return WCHAR;
 {OR}		return OR;
-{LHB}		return LHB;
-{RHB}		return RHB;
-{LHSB}		return LHSB;
-{RHSB}		return RHSB;
+{LPAREN}	return LPAREN;
+{RPAREN}	return RPAREN;
+{LBRACK}	return LBRACK;
+{RBRACK}	return RBRACK;
 
 {HEX}		{
 			/* Hex value, convert to decimal and return numeric */

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.26 src/tests/lib/libcurses/director/testlang_parse.y:1.27
--- src/tests/lib/libcurses/director/testlang_parse.y:1.26	Sun Feb  7 17:26:15 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 17:32:55 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.26 2021/02/07 17:26:15 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.27 2021/02/07 17:32:55 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -189,7 +189,7 @@ extern saved_data_t saved_output;
 %token  ASSIGN
 %token  CCHAR
 %token  WCHAR
-%token EOL CALL CHECK NOINPUT OR MULTIPLIER LHB RHB LHSB RHSB
+%token EOL CALL CHECK NOINPUT OR MULTIPLIER LPAREN RPAREN LBRACK RBRACK
 %token CALL2 CALL3 CALL4 DRAIN
 
 %nonassoc OR
@@ -219,7 +219,7 @@ statement	: assign
 assign		: ASSIGN VARNAME numeric {
 			set_var(data_number, $2, $3);
 		}
-		| ASSIGN VARNAME LHB expr RHB {
+		| ASSIGN VARNAME LPAREN expr RPAREN {
 			set_var(data_number, $2, $4);
 		}
 		| ASSIGN VARNAME STRING {
@@ -241,7 +241,7 @@ wchar		: WCHAR VARNAME char_vals {
 		;
 
 attributes	: numeric
-		| LHB expr RHB {
+		| LPAREN expr RPAREN {
 			$$ = $2;
 		}
 		| VARIABLE {
@@ -252,7 +252,7 @@ attributes	: numeric
 char_vals	: numeric {
 			add_to_vals(data_number, $1);
 		}
-		| LHSB array RHSB
+		| LBRACK array RBRACK
 		| VARIABLE {
 			add_to_vals(data_var, $1);
 		}
@@ -451,7 +451,7 @@ result		: returns
 		;
 
 returns		: numeric { assign_rets(data_number, $1); }
-		| LHB expr RHB { assign_rets(data_number, $2); }
+		| LPAREN expr RPAREN { assign_rets(data_number, $2); }
 		| STRING { assign_rets(data_string, $1); }
 		| BYTE { assign_rets(data_byte, (void *) $1); }
 		| ERR_RET { assign_rets(data_err, NULL); }
@@ -549,7 +549,7 @@ args		: /* empty */
 		| arg args
 		;
 
-arg		: LHB expr RHB {
+arg		: LPAREN expr RPAREN {
 			assign_arg(data_static, $2);
 		}
 		| numeric {



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 17:26:15 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: use standard indentation for grammar rule 'arg'


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.25 src/tests/lib/libcurses/director/testlang_parse.y:1.26
--- src/tests/lib/libcurses/director/testlang_parse.y:1.25	Sun Feb  7 17:23:29 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 17:26:15 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.25 2021/02/07 17:23:29 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.26 2021/02/07 17:26:15 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -549,15 +549,33 @@ args		: /* empty */
 		| arg args
 		;
 
-arg		: LHB expr RHB { assign_arg(data_static, $2); }
-		| numeric { assign_arg(data_static, $1); }
-		| STRING { assign_arg(data_static, $1); }
-		| BYTE { assign_arg(data_byte, $1); }
-		| PATH { assign_arg(data_static, $1); }
-		| FILENAME { assign_arg(data_static, $1); }
-		| VARNAME { assign_arg(data_static, $1); }
-		| VARIABLE  { assign_arg(data_var, $1); }
-		| NULL_RET { assign_arg(data_null, $1); }
+arg		: LHB expr RHB {
+			assign_arg(data_static, $2);
+		}
+		| numeric {
+			assign_arg(data_static, $1);
+		}
+		| STRING {
+			assign_arg(data_static, $1);
+		}
+		| BYTE {
+			assign_arg(data_byte, $1);
+		}
+		| PATH {
+			assign_arg(data_static, $1);
+		}
+		| FILENAME {
+			assign_arg(data_static, $1);
+		}
+		| VARNAME {
+			assign_arg(data_static, $1);
+		}
+		| VARIABLE {
+			assign_arg(data_var, $1);
+		}
+		| NULL_RET {
+			assign_arg(data_null, $1);
+		}
 		;
 
 eol		: EOL



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 17:26:15 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: use standard indentation for grammar rule 'arg'


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 17:23:29 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: extract grammar rule 'arg'


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.24 src/tests/lib/libcurses/director/testlang_parse.y:1.25
--- src/tests/lib/libcurses/director/testlang_parse.y:1.24	Sun Feb  7 12:56:53 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 17:23:29 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.24 2021/02/07 12:56:53 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.25 2021/02/07 17:23:29 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -546,15 +546,18 @@ expr		: numeric
 
 		/* TODO: split into 'arg' */
 args		: /* empty */
-		| LHB expr RHB { assign_arg(data_static, $2); } args
-		| numeric { assign_arg(data_static, $1); } args
-		| STRING { assign_arg(data_static, $1); } args
-		| BYTE { assign_arg(data_byte, $1); } args
-		| PATH { assign_arg(data_static, $1); } args
-		| FILENAME { assign_arg(data_static, $1); } args
-		| VARNAME { assign_arg(data_static, $1); } args
-		| VARIABLE  { assign_arg(data_var, $1); } args
-		| NULL_RET { assign_arg(data_null, $1); } args
+		| arg args
+		;
+
+arg		: LHB expr RHB { assign_arg(data_static, $2); }
+		| numeric { assign_arg(data_static, $1); }
+		| STRING { assign_arg(data_static, $1); }
+		| BYTE { assign_arg(data_byte, $1); }
+		| PATH { assign_arg(data_static, $1); }
+		| FILENAME { assign_arg(data_static, $1); }
+		| VARNAME { assign_arg(data_static, $1); }
+		| VARIABLE  { assign_arg(data_var, $1); }
+		| NULL_RET { assign_arg(data_null, $1); }
 		;
 
 eol		: EOL



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 17:23:29 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: extract grammar rule 'arg'


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/usr.bin/make/unit-tests

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 17:17:25 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: var-op-sunsh.mk

Log Message:
make: fix typo in comment in test


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/var-op-sunsh.mk

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

Modified files:

Index: src/usr.bin/make/unit-tests/var-op-sunsh.mk
diff -u src/usr.bin/make/unit-tests/var-op-sunsh.mk:1.6 src/usr.bin/make/unit-tests/var-op-sunsh.mk:1.7
--- src/usr.bin/make/unit-tests/var-op-sunsh.mk:1.6	Sun Nov 15 20:20:58 2020
+++ src/usr.bin/make/unit-tests/var-op-sunsh.mk	Sun Feb  7 17:17:25 2021
@@ -1,4 +1,4 @@
-# $NetBSD: var-op-sunsh.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: var-op-sunsh.mk,v 1.7 2021/02/07 17:17:25 rillig Exp $
 #
 # Tests for the :sh= variable assignment operator, which runs its right-hand
 # side through the shell.  It is a seldom-used alternative to the !=
@@ -75,7 +75,7 @@ VAR.key:shift=		Shift
 # the ':sh' assignment operator modifier.  Let's see what happens ...
 #
 # Well, the end result is correct but the way until there is rather
-# adventurous.  This only works because the parser replaces each an every
+# adventurous.  This only works because the parser replaces each and every
 # whitespace character that is not nested with '\0' (see Parse_DoVar).
 # The variable name therefore ends before the first ':sh', and the last
 # ':sh' turns the assignment operator into the shell command evaluation.



CVS commit: src/usr.bin/make/unit-tests

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 17:17:25 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: var-op-sunsh.mk

Log Message:
make: fix typo in comment in test


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/var-op-sunsh.mk

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



CVS commit: src/doc

2021-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb  7 16:58:53 UTC 2021

Modified Files:
src/doc: CHANGES

Log Message:
Note Emulate3Buttons support for X68k Xorg based monolithic server.


To generate a diff of this commit:
cvs rdiff -u -r1.2778 -r1.2779 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2778 src/doc/CHANGES:1.2779
--- src/doc/CHANGES:1.2778	Wed Jan 27 05:27:01 2021
+++ src/doc/CHANGES	Sun Feb  7 16:58:53 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2778 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2779 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -330,3 +330,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	pppd(8): updated to version 2.4.9. [christos 20210109]
 	tzdata updated to 2021a [kre 20210124] 
 	evbmips: Add support for QEMU "mipssim" emulator. [simonb 20210127]
+	x68k: Add Emulate3Buttons support to X68k Xorg based monolithic server.
+		[tsutsui 20210207]



CVS commit: src/doc

2021-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb  7 16:58:53 UTC 2021

Modified Files:
src/doc: CHANGES

Log Message:
Note Emulate3Buttons support for X68k Xorg based monolithic server.


To generate a diff of this commit:
cvs rdiff -u -r1.2778 -r1.2779 src/doc/CHANGES

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



CVS commit: src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k

2021-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb  7 16:56:00 UTC 2021

Modified Files:
src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k: Makefile

Log Message:
Build mouseEmu3btn.c for added Emulate3Buttons support.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k/Makefile
diff -u src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k/Makefile:1.9 src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k/Makefile:1.10
--- src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k/Makefile:1.9	Wed Aug  5 15:48:09 2020
+++ src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k/Makefile	Sun Feb  7 16:56:00 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2020/08/05 15:48:09 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.10 2021/02/07 16:56:00 tsutsui Exp $
 
 .include 
 
@@ -18,6 +18,7 @@ WARNS?=	2
 .PATH:	${X11SRCDIR.xorg-server}/hw/netbsd/x68k
 SRCS=	x68kInit.c x68kConfig.c x68kIo.c x68kMouse.c x68kKbd.c x68kKeyMap.c \
 	x68kFb.c x68kGraph.c x68kText.c
+SRCS+=	mouseEmu3btn.c
 
 .PATH:	${X11SRCDIR.xorg-server}/Xi
 SRCS+=	stubs.c



CVS commit: src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k

2021-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb  7 16:56:00 UTC 2021

Modified Files:
src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k: Makefile

Log Message:
Build mouseEmu3btn.c for added Emulate3Buttons support.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/external/mit/xorg/server/xorg-server/hw/netbsd/x68k/Makefile

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



CVS commit: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k

2021-02-07 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sun Feb  7 16:55:18 UTC 2021

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k: x68k.h x68kMouse.c
Added Files:
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k: mouseEmu3btn.c
mouseEmu3btn.h

Log Message:
Add "Emulate3Buttons" support to the X68k Xorg based monolithic server.

Based on "Emulate3Buttons" functions in the xf86-input-mouse driver,
with various refactoring and cleanups:
- rewrite a magic three-dimensional array for a finate state machine
  with proper named structures etc.
- separate 3 button emulation functions from other stuff

See my post on port-x68k@ (and tech-x11@) for more details:
 https://mail-index.netbsd.org/port-x68k/2021/02/05/msg74.html


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/mouseEmu3btn.c \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/mouseEmu3btn.h
cvs rdiff -u -r1.6 -r1.7 \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h
cvs rdiff -u -r1.8 -r1.9 \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c

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

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h
diff -u xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h:1.6 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h:1.7
--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h:1.6	Tue Nov  3 15:52:57 2020
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h	Sun Feb  7 16:55:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: x68k.h,v 1.6 2020/11/03 15:52:57 tsutsui Exp $ */
+/* $NetBSD: x68k.h,v 1.7 2021/02/07 16:55:18 tsutsui Exp $ */
 /*-
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -64,6 +64,7 @@
 #include 
 
 #include "x68kReg.h"
+#include "mouseEmu3btn.h"
 
 /*
  * X68k dependent screen record
@@ -106,6 +107,7 @@ typedef struct _X68kFbProcRec {
 typedef struct _X68kMousePriv {
 int fd;
 int bmask;
+MouseEmu3btn emu3btn;
 } X68kMousePriv, *X68kMousePrivPtr;
 
 typedef struct _X68kKbdPriv {

Index: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c
diff -u xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c:1.8 xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c:1.9
--- xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c:1.8	Fri Nov 20 19:06:56 2020
+++ xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c	Sun Feb  7 16:55:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: x68kMouse.c,v 1.8 2020/11/20 19:06:56 tsutsui Exp $ */
+/* $NetBSD: x68kMouse.c,v 1.9 2021/02/07 16:55:18 tsutsui Exp $ */
 /*-
  * Copyright (c) 1996 Yasushi Yamasaki
  * All rights reserved.
@@ -128,6 +128,9 @@ x68kMouseProc(DeviceIntPtr device, int w
 BYTE	map[4];
 Atom btn_labels[3] = {0};
 Atom axes_labels[2] = { 0, 0 };
+MouseEmu3btnPtr pEmu3btn;
+Bool emu3enable;
+int emu3timeout;
 
 switch (what) {
 	case DEVICE_INIT:
@@ -149,6 +152,15 @@ x68kMouseProc(DeviceIntPtr device, int w
 	InitPointerDeviceStruct(pMouse, map, 3, btn_labels,
 		x68kMouseCtrl, GetMotionHistorySize(),
 		2, axes_labels);
+
+	/* Initialize emulation 3 buttons settings */
+	emu3enable = TRUE;			/* XXX should be configurable */
+	emu3timeout = EMU3B_DEF_TIMEOUT;	/* XXX should be configurable */
+	if (emu3enable) {
+		pEmu3btn = 
+		Emulate3ButtonsEnable(pEmu3btn, device, emu3timeout);
+	}
+
 	break;
 
 	case DEVICE_ON:
@@ -279,10 +291,14 @@ x68kMouseEnqueueEvent(DeviceIntPtr devic
 	 * for a single state change. Should we get a button event which
 	 * reflects the current state of affairs, that event is discarded.
 	 *
-	 * Mouse buttons start at 1.
+	 * Mouse buttons start at 1 as defined in .
+	 *
+	 * The bmask stores which buttons are currently pressed.
+	 * This bmask is also used for Emulate3Buttons functions that
+	 * assume the left button is LSB as defined in mouseEmu3btn.c.
 	 */
 	buttons = (fe->id - MS_LEFT) + 1;
-	bmask = 1 << buttons;
+	bmask = 1 << (buttons - 1);
 	if (fe->value == VKEY_UP) {
 	if (pPriv->bmask & bmask) {
 		type = ButtonRelease;
@@ -298,9 +314,14 @@ x68kMouseEnqueueEvent(DeviceIntPtr devic
 		return;
 	}
 	}
-	flag = POINTER_RELATIVE;
-	valuator_mask_zero();
-	QueuePointerEvents(device, type, buttons, flag, );
+	if (buttons == Button1 || buttons == Button3) {
+	/* Handle middle button emulation */
+	Emulate3ButtonsQueueEvent(>emu3btn, type, buttons, pPriv->bmask);
+	} else {
+	flag = POINTER_RELATIVE;
+	valuator_mask_zero();
+	QueuePointerEvents(device, type, buttons, flag, );
+	}
 	break;
 case LOC_X_DELTA:
 	valuators[0] = fe->value;

Added files:

Index: 

CVS commit: xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k

2021-02-07 Thread Izumi Tsutsui
Module Name:xsrc
Committed By:   tsutsui
Date:   Sun Feb  7 16:55:18 UTC 2021

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k: x68k.h x68kMouse.c
Added Files:
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k: mouseEmu3btn.c
mouseEmu3btn.h

Log Message:
Add "Emulate3Buttons" support to the X68k Xorg based monolithic server.

Based on "Emulate3Buttons" functions in the xf86-input-mouse driver,
with various refactoring and cleanups:
- rewrite a magic three-dimensional array for a finate state machine
  with proper named structures etc.
- separate 3 button emulation functions from other stuff

See my post on port-x68k@ (and tech-x11@) for more details:
 https://mail-index.netbsd.org/port-x68k/2021/02/05/msg74.html


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/mouseEmu3btn.c \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/mouseEmu3btn.h
cvs rdiff -u -r1.6 -r1.7 \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68k.h
cvs rdiff -u -r1.8 -r1.9 \
xsrc/external/mit/xorg-server/dist/hw/netbsd/x68k/x68kMouse.c

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



CVS commit: [netbsd-9] src/doc

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 16:43:30 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.2

Log Message:
Fix entry for ticket #1191


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.41 -r1.1.2.42 src/doc/CHANGES-9.2

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

Modified files:

Index: src/doc/CHANGES-9.2
diff -u src/doc/CHANGES-9.2:1.1.2.41 src/doc/CHANGES-9.2:1.1.2.42
--- src/doc/CHANGES-9.2:1.1.2.41	Sun Feb  7 13:53:19 2021
+++ src/doc/CHANGES-9.2	Sun Feb  7 16:43:30 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.41 2021/02/07 13:53:19 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.42 2021/02/07 16:43:30 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1440,7 +1440,7 @@ usr.bin/ftp/version.h1.92
 	PR 55857: ftp(1): don't use restartable signals.
 	[lukem, ticket #1190]
 
-sys/kern/kern_event.c1.110-1.115
+sys/kern/kern_event.c1.110-1.115 (patch)
 
 	Fix kevent(2) race causing missed events, and Go timer latency issues.
 	[jdolecek, ticket #1191]



CVS commit: [netbsd-9] src/doc

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 16:43:30 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.2

Log Message:
Fix entry for ticket #1191


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.41 -r1.1.2.42 src/doc/CHANGES-9.2

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



CVS commit: [netbsd-9] src/sys/kern

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 16:42:41 UTC 2021

Modified Files:
src/sys/kern [netbsd-9]: kern_event.c

Log Message:
Apply additional patch, requested by jdolecek in ticket #1191:

sys/kern/kern_event.c   1.110-1.115 (via patch)

Fix merge botch for the EV_ONESHOT branch.


To generate a diff of this commit:
cvs rdiff -u -r1.104.4.1 -r1.104.4.2 src/sys/kern/kern_event.c

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



CVS commit: [netbsd-9] src/sys/kern

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 16:42:41 UTC 2021

Modified Files:
src/sys/kern [netbsd-9]: kern_event.c

Log Message:
Apply additional patch, requested by jdolecek in ticket #1191:

sys/kern/kern_event.c   1.110-1.115 (via patch)

Fix merge botch for the EV_ONESHOT branch.


To generate a diff of this commit:
cvs rdiff -u -r1.104.4.1 -r1.104.4.2 src/sys/kern/kern_event.c

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

Modified files:

Index: src/sys/kern/kern_event.c
diff -u src/sys/kern/kern_event.c:1.104.4.1 src/sys/kern/kern_event.c:1.104.4.2
--- src/sys/kern/kern_event.c:1.104.4.1	Thu Feb  4 16:57:25 2021
+++ src/sys/kern/kern_event.c	Sun Feb  7 16:42:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.104.4.1 2021/02/04 16:57:25 martin Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.104.4.2 2021/02/07 16:42:41 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.104.4.1 2021/02/04 16:57:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.104.4.2 2021/02/07 16:42:41 martin Exp $");
 
 #include 
 #include 
@@ -1399,9 +1399,11 @@ relock:
 		/* XXXAD should be got from f_event if !oneshot. */
 		*kevp++ = kn->kn_kevent;
 		nkev++;
+		influx = 1;
 		if (kn->kn_flags & EV_ONESHOT) {
 			/* delete ONESHOT events after retrieval */
 			kn->kn_status &= ~KN_BUSY;
+			kq->kq_count--;
 			mutex_spin_exit(>kq_lock);
 			knote_detach(kn, fdp, true);
 			mutex_enter(>fd_lock);



CVS commit: src/sys/arch/x68k/dev

2021-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb  7 16:13:56 UTC 2021

Modified Files:
src/sys/arch/x68k/dev: ms.c

Log Message:
Remove dumb middle button emulation code from the ms(4) driver.

Also fix leftover comments (derived from the original Sun's "firm_event"
implementation as seen in sys/dev/sun/ms.c) to sync with reality on x68k.

The current implementation the ms(4) driver just checks whether
two (left/right) buttons are changed in the same packet.
This means it cannot handle a release event correctly if two
buttons pressed simultaneously are released in the different timing.

The middle button emulation should be handled in application layer
as other Xservers do, and I'll import Emulate3Buttons support for the
X68k Xorg based monolithic server.

See my post on port-x68k@ for details:
 https://mail-index.netbsd.org/port-x68k/2021/02/05/msg74.html


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/x68k/dev/ms.c

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

Modified files:

Index: src/sys/arch/x68k/dev/ms.c
diff -u src/sys/arch/x68k/dev/ms.c:1.34 src/sys/arch/x68k/dev/ms.c:1.35
--- src/sys/arch/x68k/dev/ms.c:1.34	Fri Jul 25 08:10:35 2014
+++ src/sys/arch/x68k/dev/ms.c	Sun Feb  7 16:13:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ms.c,v 1.34 2014/07/25 08:10:35 dholland Exp $ */
+/*	$NetBSD: ms.c,v 1.35 2021/02/07 16:13:56 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.34 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.35 2021/02/07 16:13:56 tsutsui Exp $");
 
 #include 
 #include 
@@ -356,8 +356,8 @@ ms_input(struct ms_softc *ms, int c)
 {
 	struct firm_event *fe;
 	int mb, ub, d, get, put, any;
-	static const char to_one[] = { 1, 2, 3 };
-	static const int to_id[] = { MS_LEFT, MS_RIGHT, MS_MIDDLE };
+	static const char to_one[] = { 1, 2, 2 };
+	static const int to_id[] = { MS_LEFT, MS_RIGHT };
 
 	/*
 	 * Discard input if not ready.  Drop sync on parity or framing
@@ -402,7 +402,7 @@ ms_input(struct ms_softc *ms, int c)
 
 	/*
 	 * We have at least one event (mouse button, delta-X, or
-	 * delta-Y; possibly all three, and possibly three separate
+	 * delta-Y; possibly all three, and possibly two separate
 	 * button events).  Deliver these events until we are out
 	 * of changes or out of room.  As events get delivered,
 	 * mark them `unchanged'.
@@ -430,12 +430,12 @@ ms_input(struct ms_softc *ms, int c)
 	ub = ms->ms_ub;
 	while ((d = mb ^ ub) != 0) {
 		/*
-		 * Mouse button change.  Convert up to three changes
+		 * Mouse button change.  Convert up to two changes
 		 * to the `first' change, and drop it into the event queue.
 		 */
 		NEXT;
-		d = to_one[d - 1];		/* from 1..7 to {1,2,4} */
-		fe->id = to_id[d - 1];		/* from {1,2,4} to ID */
+		d = to_one[d - 1];		/* from 1..3 to {1,2} */
+		fe->id = to_id[d - 1];		/* from {1,2} to ID */
 		fe->value = mb & d ? VKEY_DOWN : VKEY_UP;
 		firm_gettime(fe);
 		ADVANCE;



CVS commit: src/sys/arch/x68k/dev

2021-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb  7 16:13:56 UTC 2021

Modified Files:
src/sys/arch/x68k/dev: ms.c

Log Message:
Remove dumb middle button emulation code from the ms(4) driver.

Also fix leftover comments (derived from the original Sun's "firm_event"
implementation as seen in sys/dev/sun/ms.c) to sync with reality on x68k.

The current implementation the ms(4) driver just checks whether
two (left/right) buttons are changed in the same packet.
This means it cannot handle a release event correctly if two
buttons pressed simultaneously are released in the different timing.

The middle button emulation should be handled in application layer
as other Xservers do, and I'll import Emulate3Buttons support for the
X68k Xorg based monolithic server.

See my post on port-x68k@ for details:
 https://mail-index.netbsd.org/port-x68k/2021/02/05/msg74.html


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/x68k/dev/ms.c

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



CVS commit: src/lib/libc/stdio

2021-02-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Feb  7 15:54:09 UTC 2021

Modified Files:
src/lib/libc/stdio: fread.c

Log Message:
restore change from rev 1.23 "Avoid undefined behavior in fread(3)", mistakely
removed as part __SNBF optimization


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/stdio/fread.c

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



CVS commit: src/lib/libc/stdio

2021-02-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Feb  7 15:54:09 UTC 2021

Modified Files:
src/lib/libc/stdio: fread.c

Log Message:
restore change from rev 1.23 "Avoid undefined behavior in fread(3)", mistakely
removed as part __SNBF optimization


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/stdio/fread.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/libc/stdio/fread.c
diff -u src/lib/libc/stdio/fread.c:1.25 src/lib/libc/stdio/fread.c:1.26
--- src/lib/libc/stdio/fread.c:1.25	Mon Feb  1 17:50:53 2021
+++ src/lib/libc/stdio/fread.c	Sun Feb  7 15:54:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: fread.c,v 1.25 2021/02/01 17:50:53 jdolecek Exp $	*/
+/*	$NetBSD: fread.c,v 1.26 2021/02/07 15:54:09 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)fread.c	8.2 (Berkeley) 12/11/93";
 #else
-__RCSID("$NetBSD: fread.c,v 1.25 2021/02/01 17:50:53 jdolecek Exp $");
+__RCSID("$NetBSD: fread.c,v 1.26 2021/02/07 15:54:09 jdolecek Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -81,8 +81,6 @@ fread(void *buf, size_t size, size_t cou
 	_DIAGASSERT(buf != NULL);
 
 	FLOCKFILE(fp);
-	if (fp->_r < 0)
-		fp->_r = 0;
 	total = resid;
 	p = buf;
 
@@ -115,12 +113,18 @@ fread(void *buf, size_t size, size_t cou
 		return (count);
 	}
 
+	if (fp->_r <= 0) {
+		/* Nothing to read on enter, refill the buffers. */
+		goto refill;
+	}
+
 	while (resid > (size_t)(r = fp->_r)) {
 		(void)memcpy(p, fp->_p, (size_t)r);
 		fp->_p += r;
 		/* fp->_r = 0 ... done in __srefill */
 		p += r;
 		resid -= r;
+refill:
 		if (__srefill(fp)) {
 			/* no more input: return partial result */
 			FUNLOCKFILE(fp);



CVS commit: src/sys/arch/x68k/x68k

2021-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb  7 15:51:11 UTC 2021

Modified Files:
src/sys/arch/x68k/x68k: machdep.c

Log Message:
Restore fixes for PR/51663 lost in r1.195 (uvm_hotplug(9) merge).

The kernel crashdump and savecore(8) on NetBSD/x68k have been broken
(even without EXTNEDED_MEMORY) since NetBSD 8.0. Oops.

Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.203 -r1.204 src/sys/arch/x68k/x68k/machdep.c

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



CVS commit: src/sys/arch/x68k/x68k

2021-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb  7 15:51:11 UTC 2021

Modified Files:
src/sys/arch/x68k/x68k: machdep.c

Log Message:
Restore fixes for PR/51663 lost in r1.195 (uvm_hotplug(9) merge).

The kernel crashdump and savecore(8) on NetBSD/x68k have been broken
(even without EXTNEDED_MEMORY) since NetBSD 8.0. Oops.

Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.203 -r1.204 src/sys/arch/x68k/x68k/machdep.c

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

Modified files:

Index: src/sys/arch/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.203 src/sys/arch/x68k/x68k/machdep.c:1.204
--- src/sys/arch/x68k/x68k/machdep.c:1.203	Thu Jun 11 19:20:46 2020
+++ src/sys/arch/x68k/x68k/machdep.c	Sun Feb  7 15:51:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.203 2020/06/11 19:20:46 ad Exp $	*/
+/*	$NetBSD: machdep.c,v 1.204 2021/02/07 15:51:11 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.203 2020/06/11 19:20:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.204 2021/02/07 15:51:11 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -568,7 +568,10 @@ cpu_init_kcore_hdr(void)
 {
 	cpu_kcore_hdr_t *h = _kcore_hdr;
 	struct m68k_kcore_hdr *m = >un._m68k;
-	uvm_physseg_t i;
+	psize_t size;
+#ifdef EXTENDED_MEMORY
+	int i, seg;
+#endif
 
 	memset(_kcore_hdr, 0, sizeof(cpu_kcore_hdr));
 
@@ -617,25 +620,20 @@ cpu_init_kcore_hdr(void)
 	/*
 	 * X68k has multiple RAM segments on some models.
 	 */
-	m->ram_segs[0].start = lowram;
-	m->ram_segs[0].size = mem_size - lowram;
-
-	i = uvm_physseg_get_first();
-	
-for (uvm_physseg_get_next(i); uvm_physseg_valid_p(i); i = uvm_physseg_get_next(i)) {
-		if (uvm_physseg_valid_p(i) == false)
-			break;
-
-		const paddr_t startpfn = uvm_physseg_get_start(i);
-		const paddr_t endpfn = uvm_physseg_get_end(i);
-
-		KASSERT(startpfn != -1 && endpfn != -1);
-
-		m->ram_segs[i].start = 
-		ctob(startpfn);
-		m->ram_segs[i].size  =			
-		ctob(endpfn - startpfn);
+	size = phys_basemem_seg.end - phys_basemem_seg.start;
+	m->ram_segs[0].start = phys_basemem_seg.start;
+	m->ram_segs[0].size  = size;
+#ifdef EXTENDED_MEMORY
+	seg = 1;
+	for (i = 0; i < EXTMEM_SEGS; i++) {
+		size = phys_extmem_seg[i].end - phys_extmem_seg[i].start;
+		if (size == 0)
+			continue;
+		m->ram_segs[seg].start = phys_extmem_seg[i].start;
+		m->ram_segs[seg].size  = size;
+		seg++;
 	}
+#endif
 }
 
 /*



CVS commit: src/sys/arch/arm/ofw

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 13:59:36 UTC 2021

Modified Files:
src/sys/arch/arm/ofw: openfirm.c

Log Message:
Rename argument "bootspec" to avoid shadowing a global


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/ofw/openfirm.c

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

Modified files:

Index: src/sys/arch/arm/ofw/openfirm.c
diff -u src/sys/arch/arm/ofw/openfirm.c:1.10 src/sys/arch/arm/ofw/openfirm.c:1.11
--- src/sys/arch/arm/ofw/openfirm.c:1.10	Tue Jan 31 04:32:07 2012
+++ src/sys/arch/arm/ofw/openfirm.c	Sun Feb  7 13:59:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.10 2012/01/31 04:32:07 matt Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.11 2021/02/07 13:59:36 martin Exp $	*/
 
 /*
  * Copyright 1997
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.10 2012/01/31 04:32:07 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.11 2021/02/07 13:59:36 martin Exp $");
 
 #include 
 
@@ -647,7 +647,7 @@ OF_milliseconds(void)
 }
 
 void
-OF_boot(const char *bootspec)
+OF_boot(const char *btspec)
 {
 	static struct {
 		const char *name;
@@ -660,7 +660,7 @@ OF_boot(const char *bootspec)
 		0,
 	};
 	
-	args.bootspec = bootspec;
+	args.bootspec = btspec;
 	openfirmware();
 	while (1);			/* just in case */
 }



CVS commit: src/sys/arch/arm/ofw

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 13:59:36 UTC 2021

Modified Files:
src/sys/arch/arm/ofw: openfirm.c

Log Message:
Rename argument "bootspec" to avoid shadowing a global


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/ofw/openfirm.c

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 13:56:23 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: director.c

Log Message:
tests/libcurses: error out if called with too many arguments

This helps against users who try to add more options after the first
non-option argument and wonder why these options are silently ignored.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libcurses/director/director.c

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

Modified files:

Index: src/tests/lib/libcurses/director/director.c
diff -u src/tests/lib/libcurses/director/director.c:1.13 src/tests/lib/libcurses/director/director.c:1.14
--- src/tests/lib/libcurses/director/director.c:1.13	Sun Feb  7 13:44:22 2021
+++ src/tests/lib/libcurses/director/director.c	Sun Feb  7 13:56:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: director.c,v 1.13 2021/02/07 13:44:22 rillig Exp $	*/
+/*	$NetBSD: director.c,v 1.14 2021/02/07 13:56:23 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -176,7 +176,7 @@ main(int argc, char *argv[])
 
 	argc -= optind;
 	argv += optind;
-	if (argc < 1)
+	if (argc != 1)
 		usage();
 
 	if (termpath == NULL)



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 13:56:23 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: director.c

Log Message:
tests/libcurses: error out if called with too many arguments

This helps against users who try to add more options after the first
non-option argument and wonder why these options are silently ignored.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libcurses/director/director.c

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



CVS commit: [netbsd-8] src/doc

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 13:56:00 UTC 2021

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Ticket #1650


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.68 -r1.1.2.69 src/doc/CHANGES-8.3

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

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.68 src/doc/CHANGES-8.3:1.1.2.69
--- src/doc/CHANGES-8.3:1.1.2.68	Sat Feb  6 15:29:14 2021
+++ src/doc/CHANGES-8.3	Sun Feb  7 13:56:00 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.68 2021/02/06 15:29:14 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.69 2021/02/07 13:56:00 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -1548,3 +1548,8 @@ lib/libc/arch/mips/sys/cerror.S			1.20
 	(eg __posix_cerror() in libposix).
 	[simonb, ticket #1648]
 
+usr.sbin/isibootd/isibootd.c			1.4
+
+	Fix isibootd(8) "Cannot allocate memory" failure on amd64.
+	[tsutsui, ticket #1650]
+



CVS commit: [netbsd-8] src/doc

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 13:56:00 UTC 2021

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Ticket #1650


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.68 -r1.1.2.69 src/doc/CHANGES-8.3

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



CVS commit: [netbsd-8] src/usr.sbin/isibootd

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 13:54:01 UTC 2021

Modified Files:
src/usr.sbin/isibootd [netbsd-8]: isibootd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1650):

usr.sbin/isibootd/isibootd.c: revision 1.4

Fix "Cannot allocate memory" failure on amd64.
BIOCGBLEN ioctl of bpf(4) requires u_int, not size_t.

The problem is reported by Kenji Aoyama.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.26.1 src/usr.sbin/isibootd/isibootd.c

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

Modified files:

Index: src/usr.sbin/isibootd/isibootd.c
diff -u src/usr.sbin/isibootd/isibootd.c:1.3 src/usr.sbin/isibootd/isibootd.c:1.3.26.1
--- src/usr.sbin/isibootd/isibootd.c:1.3	Mon Apr  2 09:01:30 2012
+++ src/usr.sbin/isibootd/isibootd.c	Sun Feb  7 13:54:01 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: isibootd.c,v 1.3 2012/04/02 09:01:30 nisimura Exp $	*/
+/*	$NetBSD: isibootd.c,v 1.3.26.1 2021/02/07 13:54:01 martin Exp $	*/
 /*	Id: isiboot.c,v 1.2 1999/12/26 14:33:33 nisimura Exp 	*/
 
 /*-
@@ -364,7 +364,7 @@ createbpfport(char *ifname, uint8_t **io
 	struct ifreq ifr;
 	int fd;
 	u_int type;
-	size_t buflen;
+	u_int buflen;
 	uint8_t dladdr[ETHER_ADDR_LEN], *buf;
 #ifdef BIOCIMMEDIATE
 	u_int flag;



CVS commit: [netbsd-8] src/usr.sbin/isibootd

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 13:54:01 UTC 2021

Modified Files:
src/usr.sbin/isibootd [netbsd-8]: isibootd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1650):

usr.sbin/isibootd/isibootd.c: revision 1.4

Fix "Cannot allocate memory" failure on amd64.
BIOCGBLEN ioctl of bpf(4) requires u_int, not size_t.

The problem is reported by Kenji Aoyama.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.26.1 src/usr.sbin/isibootd/isibootd.c

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



CVS commit: [netbsd-9] src/doc

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 13:53:19 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.2

Log Message:
Ticket #1200


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.40 -r1.1.2.41 src/doc/CHANGES-9.2

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

Modified files:

Index: src/doc/CHANGES-9.2
diff -u src/doc/CHANGES-9.2:1.1.2.40 src/doc/CHANGES-9.2:1.1.2.41
--- src/doc/CHANGES-9.2:1.1.2.40	Sat Feb  6 15:31:03 2021
+++ src/doc/CHANGES-9.2	Sun Feb  7 13:53:19 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.40 2021/02/06 15:31:03 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.41 2021/02/07 13:53:19 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1489,3 +1489,8 @@ lib/libc/arch/mips/sys/cerror.S			1.20
 	(eg __posix_cerror() in libposix).
 	[simonb, ticket #1199]
 
+usr.sbin/isibootd/isibootd.c			1.4
+
+	Fix isibootd(8) "Cannot allocate memory" failure on amd64.
+	[tsutsui, ticket #1200]
+



CVS commit: [netbsd-9] src/doc

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 13:53:19 UTC 2021

Modified Files:
src/doc [netbsd-9]: CHANGES-9.2

Log Message:
Ticket #1200


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.40 -r1.1.2.41 src/doc/CHANGES-9.2

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



CVS commit: [netbsd-9] src/usr.sbin/isibootd

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 13:52:55 UTC 2021

Modified Files:
src/usr.sbin/isibootd [netbsd-9]: isibootd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1200):

usr.sbin/isibootd/isibootd.c: revision 1.4

Fix "Cannot allocate memory" failure on amd64.
BIOCGBLEN ioctl of bpf(4) requires u_int, not size_t.

The problem is reported by Kenji Aoyama.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.36.1 src/usr.sbin/isibootd/isibootd.c

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



CVS commit: [netbsd-9] src/usr.sbin/isibootd

2021-02-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Feb  7 13:52:55 UTC 2021

Modified Files:
src/usr.sbin/isibootd [netbsd-9]: isibootd.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1200):

usr.sbin/isibootd/isibootd.c: revision 1.4

Fix "Cannot allocate memory" failure on amd64.
BIOCGBLEN ioctl of bpf(4) requires u_int, not size_t.

The problem is reported by Kenji Aoyama.
Should be pulled up to netbsd-9 and netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.36.1 src/usr.sbin/isibootd/isibootd.c

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

Modified files:

Index: src/usr.sbin/isibootd/isibootd.c
diff -u src/usr.sbin/isibootd/isibootd.c:1.3 src/usr.sbin/isibootd/isibootd.c:1.3.36.1
--- src/usr.sbin/isibootd/isibootd.c:1.3	Mon Apr  2 09:01:30 2012
+++ src/usr.sbin/isibootd/isibootd.c	Sun Feb  7 13:52:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: isibootd.c,v 1.3 2012/04/02 09:01:30 nisimura Exp $	*/
+/*	$NetBSD: isibootd.c,v 1.3.36.1 2021/02/07 13:52:55 martin Exp $	*/
 /*	Id: isiboot.c,v 1.2 1999/12/26 14:33:33 nisimura Exp 	*/
 
 /*-
@@ -364,7 +364,7 @@ createbpfport(char *ifname, uint8_t **io
 	struct ifreq ifr;
 	int fd;
 	u_int type;
-	size_t buflen;
+	u_int buflen;
 	uint8_t dladdr[ETHER_ADDR_LEN], *buf;
 #ifdef BIOCIMMEDIATE
 	u_int flag;



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 13:44:22 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: director.c

Log Message:
tests/libcurses: document another bug in the test director


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libcurses/director/director.c

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

Modified files:

Index: src/tests/lib/libcurses/director/director.c
diff -u src/tests/lib/libcurses/director/director.c:1.12 src/tests/lib/libcurses/director/director.c:1.13
--- src/tests/lib/libcurses/director/director.c:1.12	Sun Feb  7 13:22:23 2021
+++ src/tests/lib/libcurses/director/director.c	Sun Feb  7 13:44:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: director.c,v 1.12 2021/02/07 13:22:23 rillig Exp $	*/
+/*	$NetBSD: director.c,v 1.13 2021/02/07 13:44:22 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -70,6 +70,9 @@ void init_parse_variables(int); /* in te
 /*
  * Handle the slave exiting unexpectedly, try to recover the exit message
  * and print it out.
+ *
+ * FIXME: Must not use stdio in a signal handler.  This leads to incomplete
+ * output in verbose mode, truncating the useful part of the error message.
  */
 static void
 slave_died(int param)



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 13:44:22 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: director.c

Log Message:
tests/libcurses: document another bug in the test director


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libcurses/director/director.c

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 13:22:23 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: director.c

Log Message:
tests/libcurses: fix usage of director


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libcurses/director/director.c

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

Modified files:

Index: src/tests/lib/libcurses/director/director.c
diff -u src/tests/lib/libcurses/director/director.c:1.11 src/tests/lib/libcurses/director/director.c:1.12
--- src/tests/lib/libcurses/director/director.c:1.11	Sat Oct 24 04:46:17 2020
+++ src/tests/lib/libcurses/director/director.c	Sun Feb  7 13:22:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: director.c,v 1.11 2020/10/24 04:46:17 blymn Exp $	*/
+/*	$NetBSD: director.c,v 1.12 2021/02/07 13:22:23 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -108,7 +108,7 @@ usage(void)
 	fprintf(stderr, "-g enables check file generation if does not exist\n");
 	fprintf(stderr, "-f forces check file generation if -g flag is set\n");
 	fprintf(stderr, "-T is a directory containing the terminfo.cdb "
-	"file, or a file holding the terminfo description n");
+	"file, or a file holding the terminfo description\n");
 	fprintf(stderr, "-s is the path to the slave executable\n");
 	fprintf(stderr, "-t is value to set TERM to for the test\n");
 	fprintf(stderr, "-I is the directory to include files\n");



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 13:22:23 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: director.c

Log Message:
tests/libcurses: fix usage of director


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libcurses/director/director.c

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



CVS commit: src/tests/lib/libcurses/tests

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 13:06:02 UTC 2021

Modified Files:
src/tests/lib/libcurses/tests: addch

Log Message:
tests/libcurses: demonstrate more bugs in addch


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcurses/tests/addch

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

Modified files:

Index: src/tests/lib/libcurses/tests/addch
diff -u src/tests/lib/libcurses/tests/addch:1.3 src/tests/lib/libcurses/tests/addch:1.4
--- src/tests/lib/libcurses/tests/addch:1.3	Sun Feb  7 01:53:54 2021
+++ src/tests/lib/libcurses/tests/addch	Sun Feb  7 13:06:02 2021
@@ -8,6 +8,7 @@ call OK addch "\n"
 # Somewhere between NetBSD 8.0 and 9.0, a bug was added to addch that
 # doubled the spaces for a tab.  Instead of 8 spaces, there are now 16.
 call OK addch "\t"
+call2 6 16 getyx STDSCR		# FIXME: must be 8, not 16
 call OK addch "8"
 call OK addch "\n"
 
@@ -15,6 +16,8 @@ call OK addch "\n"
 # doubled the spaces for a tab.  Instead of 1 space, there are now 2.
 call OK addstr "0123456"
 call OK addch "\t"
+call2 7 9 getyx STDSCR		# FIXME: with probability around 50%, the
+# 7 comes out as a 6.
 call OK addch "8"
 call OK addch "\n"
 



CVS commit: src/tests/lib/libcurses/tests

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 13:06:02 UTC 2021

Modified Files:
src/tests/lib/libcurses/tests: addch

Log Message:
tests/libcurses: demonstrate more bugs in addch


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcurses/tests/addch

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 12:56:53 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: fail on syntax errors in test files

Previously, a syntax error in a test file made the test pass, which was
outright dangerous.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.23 src/tests/lib/libcurses/director/testlang_parse.y:1.24
--- src/tests/lib/libcurses/director/testlang_parse.y:1.23	Sun Feb  7 12:48:34 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 12:56:53 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.23 2021/02/07 12:48:34 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.24 2021/02/07 12:56:53 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -2092,5 +2092,5 @@ save_slave_output(bool discard)
 static void
 yyerror(const char *msg)
 {
-	warnx("%s in line %zu of file %s", msg, line, cur_file);
+	errx(1, "%s in line %zu of file %s", msg, line, cur_file);
 }



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 12:56:53 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: fail on syntax errors in test files

Previously, a syntax error in a test file made the test pass, which was
outright dangerous.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 12:48:35 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: use a single indentation style in the test grammar

The grammar rule 'args' has been left as-is since it needs to be split
into 'args' and 'arg' first, to avoid the redundancy.

The braces in "if (create_check_file)" were misleading.  It's strange that
GCC didn't reject this.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/lib/libcurses/director/testlang_parse.y

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



CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 12:48:35 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: use a single indentation style in the test grammar

The grammar rule 'args' has been left as-is since it needs to be split
into 'args' and 'arg' first, to avoid the redundancy.

The braces in "if (create_check_file)" were misleading.  It's strange that
GCC didn't reject this.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.22 src/tests/lib/libcurses/director/testlang_parse.y:1.23
--- src/tests/lib/libcurses/director/testlang_parse.y:1.22	Sun Feb  7 12:24:18 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 12:48:34 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.22 2021/02/07 12:24:18 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.23 2021/02/07 12:48:34 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -216,60 +216,72 @@ statement	: assign
 		| /* empty */
 		;
 
-assign		: ASSIGN VARNAME numeric {set_var(data_number, $2, $3);}
-		| ASSIGN VARNAME LHB expr RHB {set_var(data_number, $2, $4);}
-		| ASSIGN VARNAME STRING {set_var(data_string, $2, $3);}
-		| ASSIGN VARNAME BYTE {set_var(data_byte, $2, $3);}
+assign		: ASSIGN VARNAME numeric {
+			set_var(data_number, $2, $3);
+		}
+		| ASSIGN VARNAME LHB expr RHB {
+			set_var(data_number, $2, $4);
+		}
+		| ASSIGN VARNAME STRING {
+			set_var(data_string, $2, $3);
+		}
+		| ASSIGN VARNAME BYTE {
+			set_var(data_byte, $2, $3);
+		}
 		;
 
-cchar		: CCHAR VARNAME attributes char_vals
-			{
-set_cchar($2, $3);
-			}
+cchar		: CCHAR VARNAME attributes char_vals {
+			set_cchar($2, $3);
+		}
 		;
 
-wchar		: WCHAR VARNAME char_vals
-			{
-set_wchar($2);
-			}
+wchar		: WCHAR VARNAME char_vals {
+			set_wchar($2);
+		}
 		;
 
 attributes	: numeric
-		| LHB expr RHB
-			{ $$ = $2; }
-		| VARIABLE
-			{ $$ = get_numeric_var($1); }
+		| LHB expr RHB {
+			$$ = $2;
+		}
+		| VARIABLE {
+			$$ = get_numeric_var($1);
+		}
 		;
 
-char_vals	: numeric
-			{ add_to_vals(data_number, $1); }
+char_vals	: numeric {
+			add_to_vals(data_number, $1);
+		}
 		| LHSB array RHSB
-		| VARIABLE
-			{ add_to_vals(data_var, $1); }
-		| STRING
-			{ add_to_vals(data_string, $1); }
-		| BYTE
-			{ add_to_vals(data_byte, $1); }
+		| VARIABLE {
+			add_to_vals(data_var, $1);
+		}
+		| STRING {
+			add_to_vals(data_string, $1);
+		}
+		| BYTE {
+			add_to_vals(data_byte, $1);
+		}
 		;
 
 call		: CALL result fn_name args {
-	do_function_call(1);
-}
+			do_function_call(1);
+		}
 		;
 
 call2		: CALL2 result result fn_name args {
-	do_function_call(2);
-}
+			do_function_call(2);
+		}
 		;
 
 call3		: CALL3 result result result fn_name args {
-	do_function_call(3);
-}
+			do_function_call(3);
+		}
 		;
 
 call4		: CALL4 result result result result fn_name args {
-	do_function_call(4);
- }
+			do_function_call(4);
+		}
 		;
 
 check		: CHECK var returns {
@@ -280,7 +292,7 @@ check		: CHECK var returns {
 		err(1, "Undefined variable in check statement, line %zu"
 		" of file %s", line, cur_file);
 
-	if (command.returns[1].data_type == data_var){
+	if (command.returns[1].data_type == data_var) {
 		vptr = [command.returns[1].data_index];
 		command.returns[1].data_type = vptr->type;
 		command.returns[1].data_len = vptr->len;
@@ -363,7 +375,7 @@ check		: CHECK var returns {
 	}
 
 	init_parse_variables(0);
- }
+}
 	;
 
 delay		: DELAY numeric {
@@ -417,22 +429,21 @@ noinput		: NOINPUT {
 	}
 
 	no_input = true;
- }
-
-compare		: COMPARE PATH
-		| COMPARE FILENAME
-{
-	compare_streams($2, true);
 }
-	;
 
+compare		: COMPARE PATH
+			/* FIXME: missing action */
+		| COMPARE FILENAME {
+			compare_streams($2, true);
+		}
+		;
 
 comparend	: COMPAREND PATH
-		| COMPAREND FILENAME
-{
-	compare_streams($2, false);
-}
-	;
+			/* FIXME: missing action */
+		| COMPAREND FILENAME {
+			compare_streams($2, false);
+		}
+		;
 
 
 result		: returns
@@ -451,87 +462,89 @@ returns		: numeric { assign_rets(data_nu
 		;
 
 var		: VARNAME {
-	assign_rets(data_var, $1);
- }
+			assign_rets(data_var, $1);
+		}
 		;
 
 reference	: VARIABLE {
-	assign_rets(data_ref, $1);
- }
+			assign_rets(data_ref, $1);
+		}
+		/* XXX: missing semicolon; how does yacc interpret this? */
 
 fn_name		: VARNAME {
-	if (command.function != NULL)
-		free(command.function);
+			if (command.function != NULL)
+free(command.function);
 
-	command.function = malloc(strlen($1) + 1);
-	if (command.function == NULL)
-		err(1, "Could not allocate memory for function name");
-	strcpy(command.function, $1);
- }
+			command.function = malloc(strlen($1) + 1);
+			if (command.function == 

CVS commit: src/tests/lib/libcurses/director

2021-02-07 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 12:24:19 UTC 2021

Modified Files:
src/tests/lib/libcurses/director: testlang_parse.y

Log Message:
tests/libcurses: clean up test case grammar for statements

Previously, each statement ended with 'eol'.  This was unnecessarily
verbose since the 'eol' is not really part of the statement, it's part
of a line.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/lib/libcurses/director/testlang_parse.y

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

Modified files:

Index: src/tests/lib/libcurses/director/testlang_parse.y
diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.21 src/tests/lib/libcurses/director/testlang_parse.y:1.22
--- src/tests/lib/libcurses/director/testlang_parse.y:1.21	Sun Feb  7 12:16:26 2021
+++ src/tests/lib/libcurses/director/testlang_parse.y	Sun Feb  7 12:24:18 2021
@@ -1,5 +1,5 @@
 %{
-/*	$NetBSD: testlang_parse.y,v 1.21 2021/02/07 12:16:26 rillig Exp $	*/
+/*	$NetBSD: testlang_parse.y,v 1.22 2021/02/07 12:24:18 rillig Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn 
@@ -197,7 +197,7 @@ extern saved_data_t saved_output;
 %%
 
 statements	: /* empty */
-		| statement statements
+		| statement eol statements
 		;
 
 statement	: assign
@@ -213,22 +213,22 @@ statement	: assign
 		| comparend
 		| cchar
 		| wchar
-		| eol
+		| /* empty */
 		;
 
-assign		: ASSIGN VARNAME numeric {set_var(data_number, $2, $3);} eol
-		| ASSIGN VARNAME LHB expr RHB {set_var(data_number, $2, $4);} eol
-		| ASSIGN VARNAME STRING {set_var(data_string, $2, $3);} eol
-		| ASSIGN VARNAME BYTE {set_var(data_byte, $2, $3);} eol
+assign		: ASSIGN VARNAME numeric {set_var(data_number, $2, $3);}
+		| ASSIGN VARNAME LHB expr RHB {set_var(data_number, $2, $4);}
+		| ASSIGN VARNAME STRING {set_var(data_string, $2, $3);}
+		| ASSIGN VARNAME BYTE {set_var(data_byte, $2, $3);}
 		;
 
-cchar		: CCHAR VARNAME attributes char_vals eol
+cchar		: CCHAR VARNAME attributes char_vals
 			{
 set_cchar($2, $3);
 			}
 		;
 
-wchar		: WCHAR VARNAME char_vals eol
+wchar		: WCHAR VARNAME char_vals
 			{
 set_wchar($2);
 			}
@@ -252,27 +252,27 @@ char_vals	: numeric
 			{ add_to_vals(data_byte, $1); }
 		;
 
-call		: CALL result fn_name args eol {
+call		: CALL result fn_name args {
 	do_function_call(1);
 }
 		;
 
-call2		: CALL2 result result fn_name args eol {
+call2		: CALL2 result result fn_name args {
 	do_function_call(2);
 }
 		;
 
-call3		: CALL3 result result result fn_name args eol {
+call3		: CALL3 result result result fn_name args {
 	do_function_call(3);
 }
 		;
 
-call4		: CALL4 result result result result fn_name args eol {
+call4		: CALL4 result result result result fn_name args {
 	do_function_call(4);
  }
 		;
 
-check		: CHECK var returns eol {
+check		: CHECK var returns {
 	ct_data_t retvar;
 	var_t *vptr;
 
@@ -366,7 +366,7 @@ check		: CHECK var returns eol {
  }
 	;
 
-delay		: DELAY numeric eol {
+delay		: DELAY numeric {
 	/* set the inter-character delay */
 	if (sscanf($2, "%d", _delay) == 0)
 		err(1, "delay specification %s could not be converted to "
@@ -394,7 +394,7 @@ delay		: DELAY numeric eol {
  }
 	;
 
-input		: INPUT STRING eol {
+input		: INPUT STRING {
 	if (input_str != NULL) {
 		warnx("%s, %zu: Discarding unused input string",
 		cur_file, line);
@@ -409,7 +409,7 @@ input		: INPUT STRING eol {
 	;
 
 
-noinput		: NOINPUT eol {
+noinput		: NOINPUT {
 	if (input_str != NULL) {
 		warnx("%s, %zu: Discarding unused input string",
 		cur_file, line);
@@ -419,16 +419,16 @@ noinput		: NOINPUT eol {
 	no_input = true;
  }
 
-compare		: COMPARE PATH eol
-		| COMPARE FILENAME eol
+compare		: COMPARE PATH
+		| COMPARE FILENAME
 {
 	compare_streams($2, true);
 }
 	;
 
 
-comparend	: COMPAREND PATH eol
-		| COMPAREND FILENAME eol
+comparend	: COMPAREND PATH
+		| COMPAREND FILENAME
 {
 	compare_streams($2, false);
 }



  1   2   >