Re: CVS commit: src/sys/dev/scsipi

2013-08-10 Thread Frank Kardel

Hi Erik !

I agree that 5 minutes is a really long time. Actually the inventory 
command will
wait even longer (5 min per element + 10 minutes as safeguard - I didn't 
change that).
Generating a uprintf would mean to manage a separate callout and using, 
I believe,

the tprintf() call from the callout function.

I am not sure whether that is worth the trouble. What timeout should we 
take for the
uprintf ? People with a slow device with a waiting indicator every 10 
seconds will not gain
any additional information other that they happen to have a slow device. 
Mostly changers
are used in automated environments. I am not looking at night at the 
operations of
our changers, but I am really annoyed when work is being aborted because 
of the scsi

timeout being too short.

tl;dr
I'd prefer not to add 'interactive experience' support to the kernel, 
Maybe someone can wip
up some tools(commands) for interactive usage. Maybe a warning about 
possible long

operation times in the chio man page could help.

Frank

On 08/10/13 00:06, Erik Fair wrote:

On Aug 9, 2013, at 12:58 , Frank Kardel kar...@netbsd.org wrote:


Module Name:src
Committed By:   kardel
Date:   Fri Aug  9 19:58:44 UTC 2013

Modified Files:
src/sys/dev/scsipi: ch.c

Log Message:
bump command timeout to 5 minutes. several
types of changers (Overland PowerLoader, Dell
PowerVault) have been exceeding the 100 sec
limit aborting a perfectly (slowly) progressing
operation.

I think the kernel should uprintf(9) a notice to the effect that it has 
exceeded some (sooner than the 5 minute timeout) threshold and that it's really 
waiting for the device. Five minutes is a very long time for a timeout 
involving nominally local I/O devices. Without some progress indicator, users 
are likely to begin beating the system up (power cycle, etc) absent some 
persuasion to be patient.

Erik f...@netbsd.org





Re: CVS commit: src/sys/dev/scsipi

2013-08-10 Thread Frank Kardel

Erik,

I agree with this very much. Actually I have been toying around with 
this idea
quite some time. My thoughts where to build a sysctl tree for all scsi 
commands
with their default values and another level of sysctl timeout nodes 
where the
vendor and device name or driver name is part of the hierarchy to 
override timeouts

for some commands. Solaris has, I believe some of those knobs.

So far I didn't manage to invest the time for a complete implementation.

But maybe, as we currently are only suffering with changers, it would be 
sufficient
to add a single timeout knob for the changers. Like 
dev.ch0.scsi_timeout=300 (s)


How about that?

Frank

On 08/10/13 00:14, Erik Fair wrote:

On Aug 9, 2013, at 12:58 , Frank Kardel kar...@netbsd.org wrote:


Module Name:src
Committed By:   kardel
Date:   Fri Aug  9 19:58:44 UTC 2013

Modified Files:
src/sys/dev/scsipi: ch.c

Log Message:
bump command timeout to 5 minutes. several
types of changers (Overland PowerLoader, Dell
PowerVault) have been exceeding the 100 sec
limit aborting a perfectly (slowly) progressing
operation.

Upon further reflection, I believe that this timeout value should be a 
device-specific tunable parameter because there is such wide variation in 
changer behavior/performance; perhaps by kernel config, or by sysctl(8) on a 
per-device-node basis. Or some other mechanism you prefer.

I believe that baking it into the kernel as a constant is not good design 
because we'll just see another commit just like this one at some later date, 
continuing to patch around the design problem.

Erik f...@netbsd.org





Re: CVS commit: src/sys/dev/usb

2013-08-10 Thread Jeff Rizzo

On 8/10/13 2:15 PM, John Nemeth wrote:

Module Name:src
Committed By:   jnemeth
Date:   Sat Aug 10 21:15:26 UTC 2013

Modified Files:
src/sys/dev/usb: if_urtwn.c usbdevs usbdevs.h usbdevs_data.h

Log Message:
PR/48112 - Kai-Uwe Eckhardt -- add support for Sitecom N300 usb wifi adapter


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.651 -r1.652 src/sys/dev/usb/usbdevs
cvs rdiff -u -r1.643 -r1.644 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.644 -r1.645 src/sys/dev/usb/usbdevs_data.h

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




When making changes to usbdevs (or pcidevs, or similar files), you 
should always commit the change *first*, then regenerate usbdevs.h and 
usbdevs_data.h, because they embed the version of usbdevs. Also, it 
makes for easier pullups.


+j



CVS commit: src/sys/dev/pci

2013-08-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Aug 10 18:01:31 UTC 2013

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

Log Message:
Make sure to check if the driver has a valid intr handler in virtio_detach().

Fixes a panic during shutdown on KVM under ubuntu 13.04 with virtio,
as reported in PR kern/48105 by Richard Hansen.

Should be pulled up to netbsd-6 branches.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/virtio.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/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.3 src/sys/dev/pci/virtio.c:1.4
--- src/sys/dev/pci/virtio.c:1.3	Wed Nov  2 23:05:52 2011
+++ src/sys/dev/pci/virtio.c	Sat Aug 10 18:01:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $	*/
+/*	$NetBSD: virtio.c,v 1.4 2013/08/10 18:01:31 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: virtio.c,v 1.4 2013/08/10 18:01:31 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -199,8 +199,10 @@ virtio_detach(device_t self, int flags)
 	}
 	KASSERT(sc-sc_child == 0 || sc-sc_child == (void*)1);
 	KASSERT(sc-sc_vqs == 0);
-	pci_intr_disestablish(sc-sc_pc, sc-sc_ih);
-	sc-sc_ih = 0;
+	if (sc-sc_ih != NULL) {
+		pci_intr_disestablish(sc-sc_pc, sc-sc_ih);
+		sc-sc_ih = NULL;
+	}
 	if (sc-sc_iosize)
 		bus_space_unmap(sc-sc_iot, sc-sc_ioh, sc-sc_iosize);
 	sc-sc_iosize = 0;



CVS commit: src/sys/dev/pci/bktr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 18:14:21 UTC 2013

Modified Files:
src/sys/dev/pci/bktr: bktr_os.c

Log Message:
Redo -r1.53 correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pci/bktr/bktr_os.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/bktr/bktr_os.c
diff -u src/sys/dev/pci/bktr/bktr_os.c:1.61 src/sys/dev/pci/bktr/bktr_os.c:1.62
--- src/sys/dev/pci/bktr/bktr_os.c:1.61	Sat Oct 27 17:18:36 2012
+++ src/sys/dev/pci/bktr/bktr_os.c	Sat Aug 10 18:14:21 2013
@@ -1,6 +1,6 @@
 /* $SourceForge: bktr_os.c,v 1.5 2003/03/11 23:11:25 thomasklausner Exp $ */
 
-/*	$NetBSD: bktr_os.c,v 1.61 2012/10/27 17:18:36 chs Exp $	*/
+/*	$NetBSD: bktr_os.c,v 1.62 2013/08/10 18:14:21 dholland Exp $	*/
 /* $FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.20 2000/10/20 08:16:53 roger Exp$ */
 
 /*
@@ -51,7 +51,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bktr_os.c,v 1.61 2012/10/27 17:18:36 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: bktr_os.c,v 1.62 2013/08/10 18:14:21 dholland Exp $);
 
 #ifdef __FreeBSD__
 #include bktr.h
@@ -165,7 +165,7 @@ SYSCTL_INT(_hw_bt848, OID_AUTO, slow_msp
 #define BKTR_DEBUG
 #ifdef BKTR_DEBUG
 int bktr_debug = 0;
-#define DPR(x)	if (bktr_debug) printf x
+#define DPR(x)	(bktr_debug ? printf x : (void)0)
 #else
 #define DPR(x)
 #endif



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:28:15 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_inc_64.S

Log Message:
Fix add - adds


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.3 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.4
--- src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.3	Mon Oct 29 14:09:38 2012
+++ src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S	Sat Aug 10 18:28:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_inc_64.S,v 1.3 2012/10/29 14:09:38 chs Exp $	*/
+/*	$NetBSD: atomic_inc_64.S,v 1.4 2013/08/10 18:28:15 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -55,7 +55,7 @@ ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_in
 ENTRY_NP(_atomic_inc_64_nv)
 	mov	r3, r0			/* need r0 for return value */
 1:	ldrexd	r0, [r3]		/* load old value */
-	add	LO, LO, #1		/* calculate new value (return value) */
+	adds	LO, LO, #1		/* calculate new value (return value) */
 	adc	HI, HI, #0		/* fold carry into high */
 	strexd	ip, r0, [r3]		/* try to store */
 	cmp	ip, #0			/*   succeed? */



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:32:06 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_inc_64.S

Log Message:
Don't adjust return of atomic_inc_64 since it's void and doesn't return
anything.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.4 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.5
--- src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.4	Sat Aug 10 18:28:15 2013
+++ src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S	Sat Aug 10 18:32:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_inc_64.S,v 1.4 2013/08/10 18:28:15 matt Exp $	*/
+/*	$NetBSD: atomic_inc_64.S,v 1.5 2013/08/10 18:32:06 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -45,10 +45,7 @@ ENTRY_NP(_atomic_inc_64)
 #else
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
-	mvn	r2, #0			/* r2 = -1 */
-	adds	LO, LO, r2		/* add it */
-	adc	HI, HI, r2		/* add with carry */
-	RET/* return orig value */
+	RET
 	END(_atomic_inc_64)
 ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_inc_64)
 



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:38:33 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_swap_64.S

Log Message:
cmpne - cmp
Use push/pop


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S:1.2 src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S:1.3
--- src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S:1.2	Thu Sep 13 00:36:12 2012
+++ src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S	Sat Aug 10 18:38:33 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_swap_64.S,v 1.2 2012/09/13 00:36:12 matt Exp $	*/
+/*	$NetBSD: atomic_swap_64.S,v 1.3 2013/08/10 18:38:33 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -31,7 +31,7 @@
 #include atomic_op_asm.h
 
 ENTRY_NP(_atomic_swap_64)
-	str	r4, [sp, #-4]!		/* save temporary */
+	push	{r4}			/* save temporary */
 	mov	r4, r0			/* return value will be in r0 */
 #ifndef __ARM_EABI__
 	mov	r3, r2			/* r2 will be overwriten by r1 */
@@ -40,14 +40,14 @@ ENTRY_NP(_atomic_swap_64)
 1:
 	ldrexd	r0, [r4]		/* load old value */
 	strexd	ip, r2, [r4]		/* store new value */
-	cmpne	ip, #0			/*succeed? */
+	cmp	ip, #0			/*succeed? */
 	bne	1b			/*no, try again */
 #ifdef _ARM_ARCH_7
 	dmb
 #else
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
-	ldr	r4, [sp], #4		/* restore temporary */
+	pop	{r4}			/* restore temporary */
 	RET
 	END(_atomic_swap_64)
 ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64)



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:39:07 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_or_64.S

Log Message:
use push/pop


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_or_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_or_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.2 src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.3
--- src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.2	Thu Sep 13 00:36:12 2012
+++ src/common/lib/libc/arch/arm/atomic/atomic_or_64.S	Sat Aug 10 18:39:07 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_or_64.S,v 1.2 2012/09/13 00:36:12 matt Exp $	*/
+/*	$NetBSD: atomic_or_64.S,v 1.3 2013/08/10 18:39:07 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,15 +33,15 @@
 #ifdef _ARM_ARCH_6
 
 ENTRY_NP(_atomic_or_64)
-	str	r4, [sp, #-4]!		/* save temporary */
+	push	{r4}			/* save temporary */
 #ifndef __ARM_EABI__
 	mov	r3, r2
 	mov	r2, r1
 #endif
 	mov	r4, r0			/* need r0 for return value */
 1:	ldrexd	r0, [r4]		/* load old value (to be returned) */
-	orr	r2, r0, r2		/* calculate new value */
-	orr	r3, r1, r3		/* calculate new value */
+	orr	r2, r2, r0		/* calculate new value */
+	orr	r3, r3, r1		/* calculate new value */
 	strexd	ip, r2, [r4]		/* try to store */
 	cmp	ip, #0			/*   succeed? */
 	bne	1b			/* no, try again */
@@ -50,13 +50,13 @@ ENTRY_NP(_atomic_or_64)
 #else
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
-	ldr	r4, [sp], #4		/* restore temporary */
+	pop	{r4}			/* restore temporary */
 	RET/* return old value */
 	END(_atomic_or_64)
 ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64)
 
 ENTRY_NP(_atomic_or_64_nv)
-	str	r4, [sp, #-4]!		/* save temporary */
+	push	{r4}			/* save temporary */
 #ifndef __ARM_EABI__
 	mov	r3, r2
 	mov	r2, r1
@@ -73,7 +73,7 @@ ENTRY_NP(_atomic_or_64_nv)
 #else
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
-	ldr	r4, [sp], #4		/* restore temporary */
+	pop	{r4}			/* restore temporary */
 	RET/* return new value */
 	END(_atomic_or_64_nv)
 ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64_nv)



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:39:25 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_and_64.S

Log Message:
Use push/pop


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_and_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.2 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.3
--- src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.2	Thu Sep 13 00:36:12 2012
+++ src/common/lib/libc/arch/arm/atomic/atomic_and_64.S	Sat Aug 10 18:39:25 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_and_64.S,v 1.2 2012/09/13 00:36:12 matt Exp $	*/
+/*	$NetBSD: atomic_and_64.S,v 1.3 2013/08/10 18:39:25 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,15 +33,15 @@
 #ifdef _ARM_ARCH_6
 
 ENTRY_NP(_atomic_and_64)
-	str	r4, [sp, #-4]!		/* save temporary */
+	push	{r4}			/* save temporary */
 #ifndef __ARM_EABI__
 	mov	r3, r2
 	mov	r2, r1
 #endif
 	mov	r4, r0			/* need r0 for return value */
 1:	ldrexd	r0, [r4]		/* load old value (to be returned) */
-	and	r2, r0, r2		/* calculate new value */
-	and	r3, r1, r3		/* calculate new value */
+	and	r2, r2, r0		/* calculate new value */
+	and	r3, r3, r1		/* calculate new value */
 	strexd	ip, r2, [r4]		/* try to store */
 	cmp	ip, #0			/*   succeed? */
 	bne	1b			/* no, try again */
@@ -50,13 +50,13 @@ ENTRY_NP(_atomic_and_64)
 #else
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
-	ldr	r4, [sp], #4		/* restore temporary */
+	pop	{r4}			/* restore temporary */
 	RET/* return old value */
 	END(_atomic_and_64)
 ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64)
 
 ENTRY_NP(_atomic_and_64_nv)
-	str	r4, [sp, #-4]!		/* save temporary */
+	push	{r4}			/* save temporary */
 #ifndef __ARM_EABI__
 	mov	r3, r2
 	mov	r2, r1
@@ -73,7 +73,7 @@ ENTRY_NP(_atomic_and_64_nv)
 #else
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
-	ldr	r4, [sp], #4		/* restore temporary */
+	pop	{r4}			/* restore temporary */
 	RET/* return new value */
 	END(_atomic_and_64_nv)
 ATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64_nv)



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:39:48 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_add_64.S

Log Message:
use push/pop


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_add_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.3 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.4
--- src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.3	Thu Sep 13 00:36:12 2012
+++ src/common/lib/libc/arch/arm/atomic/atomic_add_64.S	Sat Aug 10 18:39:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_add_64.S,v 1.3 2012/09/13 00:36:12 matt Exp $	*/
+/*	$NetBSD: atomic_add_64.S,v 1.4 2013/08/10 18:39:48 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,15 +33,15 @@
 #ifdef _ARM_ARCH_6
 
 ENTRY_NP(_atomic_add_64)
-	str	r4, [sp, #-4]!		/* save temporary */
+	push	{r4}			/* save temporary */
 	mov	r4, r0			/* need r0 for return value */
 #ifndef __ARM_EABI__
 	mov	r3, r2
 	mov	r2, r1
 #endif
 1:	ldrexd	r0, [r4]		/* load old value (to be returned) */
-	adds	NLO, LO, NLO		/* calculate new value */
-	adc	NHI, HI, NHI		/* calculate new value */
+	adds	NLO, NLO, LO		/* calculate new value */
+	adc	NHI, NHI, HI		/* calculate new value */
 	strexd	ip, r2, [r4]		/* try to store */
 	cmp	ip, #0			/*   succeed? */
 	bne	1b			/* no, try again */
@@ -50,13 +50,13 @@ ENTRY_NP(_atomic_add_64)
 #else
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
-	ldr	r4, [sp], #4		/* restore temporary */
+	pop	{r4}			/* restore temporary */
 	RET/* return old value */
 	END(_atomic_add_64)
 ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64)
 
 ENTRY_NP(_atomic_add_64_nv)
-	str	r4, [sp, #-4]!		/* save temporary */
+	push	{r4}			/* save temporary */
 	mov	r4, r0			/* need r0 for return value */
 #ifndef __ARM_EABI__
 	mov	r3, r2
@@ -73,7 +73,7 @@ ENTRY_NP(_atomic_add_64_nv)
 #else
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
-	ldr	r4, [sp], #4		/* restore temporary */
+	pop	{r4}			/* restore temporary */
 	RET/* return new value */
 	END(_atomic_add_64_nv)
 ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64_nv)



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:40:19 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_dec_64.S

Log Message:
Use subs/sbc
Use push/pop
Don't adjust return for atomic_dec_64 since it's void and returns nothing


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S:1.2 src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S:1.3
--- src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S:1.2	Thu Sep 13 00:36:12 2012
+++ src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S	Sat Aug 10 18:40:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_dec_64.S,v 1.2 2012/09/13 00:36:12 matt Exp $	*/
+/*	$NetBSD: atomic_dec_64.S,v 1.3 2013/08/10 18:40:19 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,33 +33,29 @@
 #ifdef _ARM_ARCH_6
 
 ENTRY_NP(_atomic_dec_64)
-	mvn	r2, #0
 	mov	r3, r0			/* need r0 for return value */
 1:	ldrexd	r0, [r3]		/* load old value (return value) */
-	adds	LO, LO, r2		/* calculate new value */
-	adc	HI, HI, r2		/* calculate new value */
-	strexd	ip, r0, [r3]		/* try to store */
-	cmp	ip, #0			/*   succeed? */
+	subs	LO, LO, #1		/* calculate new value */
+	sbc	HI, HI, #0		/* calculate new value */
+	strexd	r2, r0, [r3]		/* try to store */
+	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again? */
 #ifdef _ARM_ARCH_7
 	dmb
 #else
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
-	adds	LO, LO, #1
-	adc	HI, HI, #0
-	RET/* return old value */
+	RET
 	END(_atomic_dec_64)
 ATOMIC_OP_ALIAS(atomic_dec_64,_atomic_dec_64)
 
 ENTRY_NP(_atomic_dec_64_nv)
-	mvn	r2, #0
 	mov	r3, r0			/* need r0 for return value */
 1:	ldrexd	r0, [r3]		/* load old value */
-	adds	LO, LO, r2		/* calculate new value */
-	adc	HI, HI, r2		/* calculate new value */
-	strexd	ip, r0, [r3]		/* try to store */
-	cmp	ip, #0			/*   succeed? */
+	subs	LO, LO, #1		/* calculate new value */
+	sbc	HI, HI, #0		/* calculate new value */
+	strexd	r2, r0, [r3]		/* try to store */
+	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again? */
 #ifdef _ARM_ARCH_7
 	dmb



CVS commit: src/lib/libcrypt

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 18:42:29 UTC 2013

Modified Files:
src/lib/libcrypt: Makefile crypt-sha1.c

Log Message:
Silence -Wpointer-sign on crypt-sha1.c.
This requires casts, which is not entirely desirable; however, this way
at least no *more* pointer sign issues can creep in.

Output object files are unchanged on amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libcrypt/Makefile
cvs rdiff -u -r1.6 -r1.7 src/lib/libcrypt/crypt-sha1.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/libcrypt/Makefile
diff -u src/lib/libcrypt/Makefile:1.24 src/lib/libcrypt/Makefile:1.25
--- src/lib/libcrypt/Makefile:1.24	Fri Aug 10 04:30:47 2012
+++ src/lib/libcrypt/Makefile	Sat Aug 10 18:42:29 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.24 2012/08/10 04:30:47 joerg Exp $
+#	$NetBSD: Makefile,v 1.25 2013/08/10 18:42:29 dholland Exp $
 
 USE_SHLIBDIR=	yes
 
@@ -24,5 +24,3 @@ LDSTATIC?= -static
 .else
 .include bsd.lib.mk
 .endif
-
-COPTS.crypt-sha1.c+=	-Wno-pointer-sign

Index: src/lib/libcrypt/crypt-sha1.c
diff -u src/lib/libcrypt/crypt-sha1.c:1.6 src/lib/libcrypt/crypt-sha1.c:1.7
--- src/lib/libcrypt/crypt-sha1.c:1.6	Mon Jun 24 04:21:20 2013
+++ src/lib/libcrypt/crypt-sha1.c	Sat Aug 10 18:42:29 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: crypt-sha1.c,v 1.6 2013/06/24 04:21:20 riastradh Exp $ */
+/* $NetBSD: crypt-sha1.c,v 1.7 2013/08/10 18:42:29 dholland Exp $ */
 
 /*
  * Copyright (c) 2004, Juniper Networks, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: crypt-sha1.c,v 1.6 2013/06/24 04:21:20 riastradh Exp $);
+__RCSID($NetBSD: crypt-sha1.c,v 1.7 2013/08/10 18:42:29 dholland Exp $);
 #endif /* not lint */
 
 #include stdlib.h
@@ -130,6 +130,8 @@ __crypt_sha1 (const char *pw, const char
 int dl;
 unsigned int iterations;
 unsigned int i;
+/* XXX silence -Wpointer-sign (would be nice to fix this some other way) */
+const unsigned char *pwu = (const unsigned char *)pw;
 
 /*
  * Salt format is
@@ -166,9 +168,9 @@ __crypt_sha1 (const char *pw, const char
 /*
  * Then hmac using pw as key, and repeat...
  */
-__hmac_sha1(passwd, dl, pw, pl, hmac_buf);
+__hmac_sha1((unsigned char *)passwd, dl, pwu, pl, hmac_buf);
 for (i = 1; i  iterations; i++) {
-	__hmac_sha1(hmac_buf, SHA1_SIZE, pw, pl, hmac_buf);
+	__hmac_sha1(hmac_buf, SHA1_SIZE, pwu, pl, hmac_buf);
 }
 /* Now output... */
 pl = snprintf(passwd, sizeof(passwd), %s%u$%.*s$,



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:45:12 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_dec_64.S atomic_inc_64.S

Log Message:
Use r2 instead of ip


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S:1.3 src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S:1.4
--- src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S:1.3	Sat Aug 10 18:40:19 2013
+++ src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S	Sat Aug 10 18:45:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_dec_64.S,v 1.3 2013/08/10 18:40:19 matt Exp $	*/
+/*	$NetBSD: atomic_dec_64.S,v 1.4 2013/08/10 18:45:12 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -43,7 +43,7 @@ ENTRY_NP(_atomic_dec_64)
 #ifdef _ARM_ARCH_7
 	dmb
 #else
-	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
+	mcr	p15, 0, r2, c7, c10, 5	/* data memory barrier */
 #endif
 	RET
 	END(_atomic_dec_64)
@@ -60,7 +60,7 @@ ENTRY_NP(_atomic_dec_64_nv)
 #ifdef _ARM_ARCH_7
 	dmb
 #else
-	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
+	mcr	p15, 0, r2, c7, c10, 5	/* data memory barrier */
 #endif
 	RET/* return new value */
 	END(_atomic_dec_64_nv)

Index: src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.5 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.6
--- src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S:1.5	Sat Aug 10 18:32:06 2013
+++ src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S	Sat Aug 10 18:45:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_inc_64.S,v 1.5 2013/08/10 18:32:06 matt Exp $	*/
+/*	$NetBSD: atomic_inc_64.S,v 1.6 2013/08/10 18:45:12 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,13 +37,13 @@ ENTRY_NP(_atomic_inc_64)
 1:	ldrexd	r0, [r3]		/* load old value (return value) */
 	adds	LO, LO, #1		/* calculate new value */
 	adc	HI, HI, #0		/* zero means we carried */
-	strexd	ip, r0, [r3]		/* try to store */
-	cmp	ip, #0			/*   succeed? */
+	strexd	r2, r0, [r3]		/* try to store */
+	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again? */
 #ifdef _ARM_ARCH_7
 	dmb
 #else
-	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
+	mcr	p15, 0, r2, c7, c10, 5	/* data memory barrier */
 #endif
 	RET
 	END(_atomic_inc_64)
@@ -54,13 +54,13 @@ ENTRY_NP(_atomic_inc_64_nv)
 1:	ldrexd	r0, [r3]		/* load old value */
 	adds	LO, LO, #1		/* calculate new value (return value) */
 	adc	HI, HI, #0		/* fold carry into high */
-	strexd	ip, r0, [r3]		/* try to store */
-	cmp	ip, #0			/*   succeed? */
+	strexd	r2, r0, [r3]		/* try to store */
+	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again? */
 #ifdef _ARM_ARCH_7
 	dmb
 #else
-	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
+	mcr	p15, 0, r2, c7, c10, 5	/* data memory barrier */
 #endif
 	RET/* return new value */
 	END(_atomic_inc_64_nv)



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 19:02:22 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_add_64.S atomic_and_64.S
atomic_or_64.S

Log Message:
Never modify NLO/NHI (r2,r3) only LO/HI (r0,r1) so subsequent loops will work.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_or_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_add_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.4 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.5
--- src/common/lib/libc/arch/arm/atomic/atomic_add_64.S:1.4	Sat Aug 10 18:39:48 2013
+++ src/common/lib/libc/arch/arm/atomic/atomic_add_64.S	Sat Aug 10 19:02:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_add_64.S,v 1.4 2013/08/10 18:39:48 matt Exp $	*/
+/*	$NetBSD: atomic_add_64.S,v 1.5 2013/08/10 19:02:22 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,9 +40,9 @@ ENTRY_NP(_atomic_add_64)
 	mov	r2, r1
 #endif
 1:	ldrexd	r0, [r4]		/* load old value (to be returned) */
-	adds	NLO, NLO, LO		/* calculate new value */
-	adc	NHI, NHI, HI		/* calculate new value */
-	strexd	ip, r2, [r4]		/* try to store */
+	adds	LO, LO, NLO		/* calculate new value */
+	adc	HI, HI, NHI		/* calculate new value */
+	strexd	ip, r0, [r4]		/* try to store */
 	cmp	ip, #0			/*   succeed? */
 	bne	1b			/* no, try again */
 #ifdef _ARM_ARCH_7
@@ -51,7 +51,7 @@ ENTRY_NP(_atomic_add_64)
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
 	pop	{r4}			/* restore temporary */
-	RET/* return old value */
+	RET
 	END(_atomic_add_64)
 ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64)
 

Index: src/common/lib/libc/arch/arm/atomic/atomic_and_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.3 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.4
--- src/common/lib/libc/arch/arm/atomic/atomic_and_64.S:1.3	Sat Aug 10 18:39:25 2013
+++ src/common/lib/libc/arch/arm/atomic/atomic_and_64.S	Sat Aug 10 19:02:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_and_64.S,v 1.3 2013/08/10 18:39:25 matt Exp $	*/
+/*	$NetBSD: atomic_and_64.S,v 1.4 2013/08/10 19:02:22 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,9 +40,9 @@ ENTRY_NP(_atomic_and_64)
 #endif
 	mov	r4, r0			/* need r0 for return value */
 1:	ldrexd	r0, [r4]		/* load old value (to be returned) */
-	and	r2, r2, r0		/* calculate new value */
-	and	r3, r3, r1		/* calculate new value */
-	strexd	ip, r2, [r4]		/* try to store */
+	and	r0, r0, r2		/* calculate new value */
+	and	r1, r1, r3		/* calculate new value */
+	strexd	ip, r0, [r4]		/* try to store */
 	cmp	ip, #0			/*   succeed? */
 	bne	1b			/* no, try again */
 #ifdef _ARM_ARCH_7
@@ -51,7 +51,7 @@ ENTRY_NP(_atomic_and_64)
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
 	pop	{r4}			/* restore temporary */
-	RET/* return old value */
+	RET
 	END(_atomic_and_64)
 ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64)
 
Index: src/common/lib/libc/arch/arm/atomic/atomic_or_64.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.3 src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.4
--- src/common/lib/libc/arch/arm/atomic/atomic_or_64.S:1.3	Sat Aug 10 18:39:07 2013
+++ src/common/lib/libc/arch/arm/atomic/atomic_or_64.S	Sat Aug 10 19:02:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_or_64.S,v 1.3 2013/08/10 18:39:07 matt Exp $	*/
+/*	$NetBSD: atomic_or_64.S,v 1.4 2013/08/10 19:02:22 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,9 +40,9 @@ ENTRY_NP(_atomic_or_64)
 #endif
 	mov	r4, r0			/* need r0 for return value */
 1:	ldrexd	r0, [r4]		/* load old value (to be returned) */
-	orr	r2, r2, r0		/* calculate new value */
-	orr	r3, r3, r1		/* calculate new value */
-	strexd	ip, r2, [r4]		/* try to store */
+	orr	r0, r0, r2		/* calculate new value */
+	orr	r1, r1, r3		/* calculate new value */
+	strexd	ip, r0, [r4]		/* try to store */
 	cmp	ip, #0			/*   succeed? */
 	bne	1b			/* no, try again */
 #ifdef _ARM_ARCH_7
@@ -51,7 +51,7 @@ ENTRY_NP(_atomic_or_64)
 	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
 #endif
 	pop	{r4}			/* restore temporary */
-	RET/* return old value */
+	RET
 	END(_atomic_or_64)
 ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64)
 



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 19:59:21 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_add_32.S atomic_add_64.S
atomic_and_32.S atomic_and_64.S atomic_cas_32.S atomic_cas_64.S
atomic_cas_8.S atomic_cas_up.S atomic_dec_32.S atomic_dec_64.S
atomic_inc_32.S atomic_inc_64.S atomic_or_32.S atomic_or_64.S
atomic_swap.S atomic_swap_64.S

Log Message:
Make these under Thumb2


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/atomic/atomic_add_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_and_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_or_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_swap.S
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_cas_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S \
src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_inc_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_or_64.S
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_cas_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_cas_up.S
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_add_32.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_add_32.S:1.3 src/common/lib/libc/arch/arm/atomic/atomic_add_32.S:1.4
--- src/common/lib/libc/arch/arm/atomic/atomic_add_32.S:1.3	Fri Aug 31 23:41:52 2012
+++ src/common/lib/libc/arch/arm/atomic/atomic_add_32.S	Sat Aug 10 19:59:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_add_32.S,v 1.3 2012/08/31 23:41:52 matt Exp $	*/
+/*	$NetBSD: atomic_add_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,19 +34,19 @@
 #ifdef _ARM_ARCH_6
 
 ENTRY_NP(_atomic_add_32)
-	mov	r3, r0			/* need r0 for return value */
-1:	ldrex	r0, [r3]		/* load old value (to be returned) */
-	add	r2, r0, r1		/* calculate new value */
-	strex	ip, r2, [r3]		/* try to store */
-	cmp	ip, #0			/*   succeed? */
+1:	ldrex	r3, [r0]		/* load old value */
+	add	r3, r3, r1		/* calculate new value */
+	strex	r2, r3, [r0]		/* try to store */
+	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again */
 #ifdef _ARM_ARCH_7
 	dmb
 #else
-	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
+	mcr	p15, 0, r2, c7, c10, 5	/* data memory barrier */
 #endif
 	RET/* return old value */
-	END(_atomic_add_32)
+END(_atomic_add_32)
+
 ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32)
 ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32)
 ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_32)
@@ -56,16 +56,16 @@ STRONG_ALIAS(_atomic_add_long,_atomic_ad
 STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32)
 
 ENTRY_NP(_atomic_add_32_nv)
-	mov	r3, r0			/* need r0 for return value */
-1:	ldrex	r0, [r3]		/* load old value */
+	mov	ip, r0			/* need r0 for return value */
+1:	ldrex	r0, [ip]		/* load old value */
 	add	r0, r0, r1		/* calculate new value (return value) */
-	strex	r2, r0, [r3]		/* try to store */
+	strex	r2, r0, [ip]		/* try to store */
 	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again? */
 #ifdef _ARM_ARCH_7
 	dmb
 #else
-	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
+	mcr	p15, 0, r2, c7, c10, 5	/* data memory barrier */
 #endif
 	RET/* return new value */
 	END(_atomic_add_32_nv)
Index: src/common/lib/libc/arch/arm/atomic/atomic_and_32.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_and_32.S:1.3 src/common/lib/libc/arch/arm/atomic/atomic_and_32.S:1.4
--- src/common/lib/libc/arch/arm/atomic/atomic_and_32.S:1.3	Fri Aug 31 23:41:52 2012
+++ src/common/lib/libc/arch/arm/atomic/atomic_and_32.S	Sat Aug 10 19:59:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_and_32.S,v 1.3 2012/08/31 23:41:52 matt Exp $	*/
+/*	$NetBSD: atomic_and_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,19 +34,19 @@
 #ifdef _ARM_ARCH_6
 
 ENTRY_NP(_atomic_and_32)
-	mov	r3, r0			/* need r0 for return value */
-1:	ldrex	r0, [r3]		/* load old value (to be returned) */
-	and	r2, r0, r1		/* calculate new value */
-	strex	ip, r2, [r3]		/* try to store */
-	cmp	ip, #0			/*   succeed? */
+1:	ldrex	r3, [r0]		/* load old value (to be returned) */
+	and	r3, r3, r1		/* calculate new value */
+	strex	r2, r3, [r0]		/* try to store */
+	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again */
 #ifdef _ARM_ARCH_7
 	dmb
 #else
-	mcr	p15, 0, ip, c7, c10, 5	/* data memory barrier */
+	mcr	p15, 0, r2, c7, c10, 5	/* data 

CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 20:59:27 UTC 2013

Modified Files:
src/usr.bin/tr: tr.1

Log Message:
punctuation usage


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/tr/tr.1

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/tr/tr.1
diff -u src/usr.bin/tr/tr.1:1.20 src/usr.bin/tr/tr.1:1.21
--- src/usr.bin/tr/tr.1:1.20	Wed May 29 15:08:30 2013
+++ src/usr.bin/tr/tr.1	Sat Aug 10 20:59:27 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: tr.1,v 1.20 2013/05/29 15:08:30 wiz Exp $
+.\	$NetBSD: tr.1,v 1.21 2013/08/10 20:59:27 dholland Exp $
 .\
 .\ Copyright (c) 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -64,8 +64,8 @@ The following options are available:
 .Bl -tag -width Ds
 .It Fl c
 Complements the set of characters in
-.Ar string1 ,
-that is
+.Ar string1 ;
+that is,
 .Fl c Ar \ab
 includes every character except for
 .Sq a



CVS commit: src/sys/dev/usb

2013-08-10 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sat Aug 10 21:15:26 UTC 2013

Modified Files:
src/sys/dev/usb: if_urtwn.c usbdevs usbdevs.h usbdevs_data.h

Log Message:
PR/48112 - Kai-Uwe Eckhardt -- add support for Sitecom N300 usb wifi adapter


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.651 -r1.652 src/sys/dev/usb/usbdevs
cvs rdiff -u -r1.643 -r1.644 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.644 -r1.645 src/sys/dev/usb/usbdevs_data.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/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.24 src/sys/dev/usb/if_urtwn.c:1.25
--- src/sys/dev/usb/if_urtwn.c:1.24	Sun Apr  7 02:53:19 2013
+++ src/sys/dev/usb/if_urtwn.c	Sat Aug 10 21:15:26 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.24 2013/04/07 02:53:19 nonaka Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.25 2013/08/10 21:15:26 jnemeth Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.20 2011/11/26 06:39:33 ckuethe Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_urtwn.c,v 1.24 2013/04/07 02:53:19 nonaka Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_urtwn.c,v 1.25 2013/08/10 21:15:26 jnemeth Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_inet.h
@@ -149,6 +149,7 @@ static const struct usb_devno urtwn_devs
 	{ USB_VENDOR_SITECOMEU,	USB_PRODUCT_SITECOMEU_RTL8188CU },
 	{ USB_VENDOR_SITECOMEU,	USB_PRODUCT_SITECOMEU_RTL8188CU_2 },
 	{ USB_VENDOR_SITECOMEU,	USB_PRODUCT_SITECOMEU_RTL8192CU },
+	{ USB_VENDOR_SITECOMEU,	USB_PRODUCT_SITECOMEU_RTL8192CUR2 },
 	{ USB_VENDOR_TRENDNET,	USB_PRODUCT_TRENDNET_RTL8188CU },
 	{ USB_VENDOR_TRENDNET,	USB_PRODUCT_TRENDNET_RTL8192CU },
 	{ USB_VENDOR_ZYXEL,	USB_PRODUCT_ZYXEL_RTL8192CU }

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.651 src/sys/dev/usb/usbdevs:1.652
--- src/sys/dev/usb/usbdevs:1.651	Sat Aug  3 16:04:30 2013
+++ src/sys/dev/usb/usbdevs	Sat Aug 10 21:15:26 2013
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.651 2013/08/03 16:04:30 soren Exp $
+$NetBSD: usbdevs,v 1.652 2013/08/10 21:15:26 jnemeth Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2907,6 +2907,7 @@ product SITECOMEU WLA4000	0x0060	WLA-400
 product SITECOMEU RTL8192CU	0x0061	RTL8192CU
 product SITECOMEU WLA5000	0x0062	WLA-5000
 product SITECOMEU LN028		0x061c	LN-028
+product SITECOMEU RTL8192CUR2	0x0070	RTL8192CU rev 2/2
 product SITECOMEU WL113		0x9071	WL-113
 product SITECOMEU ZD1211B	0x9075	ZD1211B
 product SITECOMEU WL172		0x90ac	WL-172

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.643 src/sys/dev/usb/usbdevs.h:1.644
--- src/sys/dev/usb/usbdevs.h:1.643	Sat Aug  3 16:06:08 2013
+++ src/sys/dev/usb/usbdevs.h	Sat Aug 10 21:15:26 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdevs.h,v 1.643 2013/08/03 16:06:08 soren Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.644 2013/08/10 21:15:26 jnemeth Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -2914,6 +2914,7 @@
 #define	USB_PRODUCT_SITECOMEU_RTL8192CU	0x0061		/* RTL8192CU */
 #define	USB_PRODUCT_SITECOMEU_WLA5000	0x0062		/* WLA-5000 */
 #define	USB_PRODUCT_SITECOMEU_LN028	0x061c		/* LN-028 */
+#define	USB_PRODUCT_SITECOMEU_RTL8192CUR2	0x0070		/* RTL8192CU rev 2/2 */
 #define	USB_PRODUCT_SITECOMEU_WL113	0x9071		/* WL-113 */
 #define	USB_PRODUCT_SITECOMEU_ZD1211B	0x9075		/* ZD1211B */
 #define	USB_PRODUCT_SITECOMEU_WL172	0x90ac		/* WL-172 */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.644 src/sys/dev/usb/usbdevs_data.h:1.645
--- src/sys/dev/usb/usbdevs_data.h:1.644	Sat Aug  3 16:06:08 2013
+++ src/sys/dev/usb/usbdevs_data.h	Sat Aug 10 21:15:26 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdevs_data.h,v 1.644 2013/08/03 16:06:08 soren Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.645 2013/08/10 21:15:26 jnemeth Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -8899,6 +8899,10 @@ const struct usb_product usb_products[] 
 	LN-028,
 	},
 	{
+	USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_RTL8192CUR2,
+	RTL8192CU rev 2/2,
+	},
+	{
 	USB_VENDOR_SITECOMEU, USB_PRODUCT_SITECOMEU_WL113,
 	WL-113,
 	},
@@ -10003,4 +10007,4 @@ const struct usb_product usb_products[] 
 	Prestige,
 	},
 };
-const int usb_nproducts = 1966;
+const int usb_nproducts = 1967;



CVS commit: src/usr.bin/make

2013-08-10 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Aug 10 21:20:03 UTC 2013

Modified Files:
src/usr.bin/make: parse.c

Log Message:
ParseGetLine: don't treat a zero byte as end of buffer if P_end says it isn't.
Consume up to next newline, and issue a parse warning.
If no newline found before P_end, carry on as before.


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/parse.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.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.189 src/usr.bin/make/parse.c:1.190
--- src/usr.bin/make/parse.c:1.189	Tue Jun 18 19:31:27 2013
+++ src/usr.bin/make/parse.c	Sat Aug 10 21:20:03 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.189 2013/06/18 19:31:27 sjg Exp $	*/
+/*	$NetBSD: parse.c,v 1.190 2013/08/10 21:20:03 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = $NetBSD: parse.c,v 1.189 2013/06/18 19:31:27 sjg Exp $;
+static char rcsid[] = $NetBSD: parse.c,v 1.190 2013/08/10 21:20:03 sjg Exp $;
 #else
 #include sys/cdefs.h
 #ifndef lint
 #if 0
 static char sccsid[] = @(#)parse.c	8.3 (Berkeley) 3/19/94;
 #else
-__RCSID($NetBSD: parse.c,v 1.189 2013/06/18 19:31:27 sjg Exp $);
+__RCSID($NetBSD: parse.c,v 1.190 2013/08/10 21:20:03 sjg Exp $);
 #endif
 #endif /* not lint */
 #endif
@@ -2572,6 +2572,16 @@ ParseGetLine(int flags, int *length)
 		if (cf-P_end == NULL)
 		/* End of string (aka for loop) data */
 		break;
+		/* see if there is more we can parse */
+		while (ptr++  cf-P_end) {
+		if ((ch = *ptr) == '\n') {
+			if (ptr  line  ptr[-1] == '\\')
+			continue;
+			Parse_Error(PARSE_WARNING,
+			Zero byte read from file, skipping rest of line.);
+			break;
+		}
+		}
 		if (cf-nextbuf != NULL) {
 		/*
 		 * End of this buffer; return EOF and outer logic



CVS commit: src/share/man/man4

2013-08-10 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sat Aug 10 21:32:07 UTC 2013

Modified Files:
src/share/man/man4: urtwn.4

Log Message:
PR/48112 - Kai-Uwe Eckhardt -- add support for Sitecom N300 USB WIFI adapter


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/urtwn.4

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

Modified files:

Index: src/share/man/man4/urtwn.4
diff -u src/share/man/man4/urtwn.4:1.7 src/share/man/man4/urtwn.4:1.8
--- src/share/man/man4/urtwn.4:1.7	Wed Jul 31 13:34:04 2013
+++ src/share/man/man4/urtwn.4	Sat Aug 10 21:32:07 2013
@@ -1,4 +1,4 @@
-.\ $NetBSD: urtwn.4,v 1.7 2013/07/31 13:34:04 soren Exp $
+.\ $NetBSD: urtwn.4,v 1.8 2013/08/10 21:32:07 jnemeth Exp $
 .\ $OpenBSD: urtwn.4,v 1.15 2011/11/26 06:39:33 ckuethe Exp $
 .\
 .\ Copyright (c) 2010 Damien Bergamini damien.bergam...@free.fr
@@ -15,7 +15,7 @@
 .\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\
-.Dd July 31, 2013
+.Dd August 10, 2013
 .Dt URTWN 4
 .Os
 .Sh NAME
@@ -106,6 +106,7 @@ The following adapters should work:
 .It Planex GW-USValue-EZ
 .It Planex GW-USWExtreme
 .It POWCHIP POW-N18
+.It Sitecom N300 USB (WLA-2102 v1)
 .It Sitecom WL-365
 .It Solwise NET-WL-UMD-606N
 .It TRENDnet TEW-648UBM



CVS commit: src/tests/usr.bin

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 22:36:16 UTC 2013

Modified Files:
src/tests/usr.bin: Makefile
Added Files:
src/tests/usr.bin/tr: Makefile t_basic.sh

Log Message:
Add tests for tr, including an xfail one for PR 48113.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/tr/Makefile \
src/tests/usr.bin/tr/t_basic.sh

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

Modified files:

Index: src/tests/usr.bin/Makefile
diff -u src/tests/usr.bin/Makefile:1.17 src/tests/usr.bin/Makefile:1.18
--- src/tests/usr.bin/Makefile:1.17	Tue Nov 20 08:02:06 2012
+++ src/tests/usr.bin/Makefile	Sat Aug 10 22:36:16 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2012/11/20 08:02:06 agc Exp $
+#	$NetBSD: Makefile,v 1.18 2013/08/10 22:36:16 dholland Exp $
 #
 
 .include bsd.own.mk
@@ -8,6 +8,6 @@ TESTSDIR=   ${TESTSBASE}/usr.bin
 TESTS_SUBDIRS=	awk basename bzip2 cc cmp config cut \
 		diff dirname find grep gzip id infocmp jot m4 make mkdep \
 		nbperf netpgpverify pr rump_server shmif_dumpbus sdiff \
-		sed sort tmux unifdef xlint
+		sed sort tmux tr unifdef xlint
 
 .include bsd.test.mk

Added files:

Index: src/tests/usr.bin/tr/Makefile
diff -u /dev/null src/tests/usr.bin/tr/Makefile:1.1
--- /dev/null	Sat Aug 10 22:36:16 2013
+++ src/tests/usr.bin/tr/Makefile	Sat Aug 10 22:36:16 2013
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile,v 1.1 2013/08/10 22:36:16 dholland Exp $
+
+.include bsd.own.mk
+
+TESTSDIR=	${TESTSBASE}/usr.bin/tr
+
+TESTS_SH=	t_basic
+
+.include bsd.test.mk
Index: src/tests/usr.bin/tr/t_basic.sh
diff -u /dev/null src/tests/usr.bin/tr/t_basic.sh:1.1
--- /dev/null	Sat Aug 10 22:36:16 2013
+++ src/tests/usr.bin/tr/t_basic.sh	Sat Aug 10 22:36:16 2013
@@ -0,0 +1,188 @@
+# $NetBSD: t_basic.sh,v 1.1 2013/08/10 22:36:16 dholland Exp $
+#
+# Copyright (c) 2013 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by David A. Holland.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# tr -d: delete character
+#
+atf_test_case dopt
+dopt_head() {
+	atf_set descr Tests for tr -d
+}
+
+dopt_body() {
+	atf_check -o inline:'abcde\n' -x 'echo abcde | tr -d x'
+	atf_check -o inline:'abde\n' -x 'echo abcde | tr -d c'
+	atf_check -o inline:'ace\n' -x 'echo abcde | tr -d bd'
+	atf_check -o inline:'ae\n' -x 'echo abcde | tr -d b-d'
+	atf_check -o inline:'b\n' -x 'echo abcde | tr -d ac-e'
+	atf_check -o inline:'d\n' -x 'echo abcde | tr -d a-ce'
+	atf_check -o inline:'aei\n' -x 'echo abcdefghi | tr -d b-df-h'
+
+	atf_check -o inline:'' -x 'echo abcde | tr -c -d x'
+	atf_check -o inline:'c' -x 'echo abcde | tr -c -d c'
+	atf_check -o inline:'bd' -x 'echo abcde | tr -c -d bd'
+	atf_check -o inline:'bcd' -x 'echo abcde | tr -c -d b-d'
+	atf_check -o inline:'acde' -x 'echo abcde | tr -c -d ac-e'
+	atf_check -o inline:'abce' -x 'echo abcde | tr -c -d a-ce'
+	atf_check -o inline:'bcdfgh' -x 'echo abcdefghi | tr -c -d b-df-h'
+
+	# see if escape codes work
+	atf_check -o inline:'splice' -x '(echo spl; echo ice) | tr -d ''\n'
+	atf_check -o inline:'splice' -x '(echo spl; echo ice) | tr -d ''\012'
+
+	# make sure 0 works
+	# (ignore stderr as dd blabbers to it)
+	atf_check -e ignore -o inline:'ab\n' \
+	  -x '(echo -n a; dd if=/dev/zero bs=3 count=1; echo b) | tr -d ''\0'
+
+	# test posix classes
+	atf_check -o inline:'.\n' -x 'echo aAzZ.123 | tr -d ''[:alnum:]'
+	atf_check -o inline:'.123\n' -x 'echo aAzZ.123 | tr -d ''[:alpha:]'
+	atf_check -o inline:'az\n' -x 'echo a z | tr -d ''[:blank:]'
+	atf_check -o inline:'az' -x 

CVS commit: src/share/misc

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 22:37:58 UTC 2013

Modified Files:
src/share/misc: acronyms

Log Message:
+tp


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/share/misc/acronyms

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

Modified files:

Index: src/share/misc/acronyms
diff -u src/share/misc/acronyms:1.218 src/share/misc/acronyms:1.219
--- src/share/misc/acronyms:1.218	Wed Jun  5 21:03:57 2013
+++ src/share/misc/acronyms	Sat Aug 10 22:37:58 2013
@@ -1,4 +1,4 @@
-$NetBSD: acronyms,v 1.218 2013/06/05 21:03:57 dholland Exp $
+$NetBSD: acronyms,v 1.219 2013/08/10 22:37:58 dholland Exp $
 10Q	thank you
 10X	thanks
 1337	elite (leet)
@@ -492,6 +492,7 @@ TOC	table of contents
 TOCTOU	time of check to time of use
 TOEFL	test of english as a foreign language
 TOH	to other half
+TP	toilet paper
 TPTB	the powers that be
 TRT	the right thing
 TTBOMK	to the best of my knowledge



CVS commit: src/distrib/sets/lists/tests

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 22:37:06 UTC 2013

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
+tp


To generate a diff of this commit:
cvs rdiff -u -r1.542 -r1.543 src/distrib/sets/lists/tests/mi

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.542 src/distrib/sets/lists/tests/mi:1.543
--- src/distrib/sets/lists/tests/mi:1.542	Thu Jul 25 14:28:29 2013
+++ src/distrib/sets/lists/tests/mi	Sat Aug 10 22:37:06 2013
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.542 2013/07/25 14:28:29 kefren Exp $
+# $NetBSD: mi,v 1.543 2013/08/10 22:37:06 dholland Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -3048,6 +3048,10 @@
 ./usr/tests/usr.bin/tmux/Atffile		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/tmux/Kyuafile		tests-usr.bin-tests	atf,kyua
 ./usr/tests/usr.bin/tmux/t_tmux			tests-usr.bin-tests	atf
+./usr/tests/usr.bin/trtests-usr.bin-tests
+./usr/tests/usr.bin/tr/Atffile			tests-usr.bin-tests	atf
+./usr/tests/usr.bin/tr/Kyuafile			tests-usr.bin-tests	atf,kyua
+./usr/tests/usr.bin/tr/t_basic			tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/unifdef			tests-usr.bin-tests
 ./usr/tests/usr.bin/unifdef/Atffile		tests-usr.bin-tests	atf
 ./usr/tests/usr.bin/unifdef/Kyuafile		tests-usr.bin-tests	atf,kyua



CVS commit: [netbsd-6] src/sys/arch/i386/stand

2013-08-10 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Aug 10 22:42:29 UTC 2013

Modified Files:
src/sys/arch/i386/stand/boot [netbsd-6]: boot2.c
src/sys/arch/i386/stand/lib [netbsd-6]: bootmenu.c bootmenu.h

Log Message:
Pull up following revision(s) (requested by he in ticket #925):
sys/arch/i386/stand/lib/bootmenu.c: revision 1.11
sys/arch/i386/stand/lib/bootmenu.h: revision 1.3
sys/arch/i386/stand/boot/boot2.c: revision 1.59
Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:
 * Add a menu command which re-displays the menu and initiates
   the timed countdown
 * Use any default command defined in boot.cfg as default args
   if the user runs boot with no arguments
This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply boot netbsd is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


To generate a diff of this commit:
cvs rdiff -u -r1.57.2.1 -r1.57.2.2 src/sys/arch/i386/stand/boot/boot2.c
cvs rdiff -u -r1.10 -r1.10.8.1 src/sys/arch/i386/stand/lib/bootmenu.c
cvs rdiff -u -r1.2 -r1.2.26.1 src/sys/arch/i386/stand/lib/bootmenu.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/i386/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.57.2.1 src/sys/arch/i386/stand/boot/boot2.c:1.57.2.2
--- src/sys/arch/i386/stand/boot/boot2.c:1.57.2.1	Sun Aug 12 18:56:54 2012
+++ src/sys/arch/i386/stand/boot/boot2.c	Sat Aug 10 22:42:29 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.57.2.1 2012/08/12 18:56:54 martin Exp $	*/
+/*	$NetBSD: boot2.c,v 1.57.2.2 2013/08/10 22:42:29 riz Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -120,6 +120,9 @@ void	command_quit(char *);
 void	command_boot(char *);
 void	command_dev(char *);
 void	command_consdev(char *);
+#ifndef SMALL
+void	command_menu(char *);
+#endif
 void	command_modules(char *);
 void	command_multiboot(char *);
 
@@ -131,6 +134,9 @@ const struct bootblk_command commands[] 
 	{ boot,	command_boot },
 	{ dev,	command_dev },
 	{ consdev,	command_consdev },
+#ifndef SMALL
+	{ menu,	command_menu },
+#endif
 	{ modules,	command_modules },
 	{ load,	module_add },
 	{ multiboot,	command_multiboot },
@@ -394,6 +400,9 @@ command_help(char *arg)
 	   dev xd[N[x]]:\n
 	   consdev {pc|com[0123]|com[0123]kbd|auto}\n
 	   vesa {modenum|on|off|enabled|disabled|list}\n
+#ifndef SMALL
+	   menu (reenters boot menu, if defined in boot.cfg)\n
+#endif
 	   modules {on|off|enabled|disabled}\n
 	   load {path_to_module}\n
 	   multiboot [xdNx:][filename] [args]\n
@@ -439,6 +448,10 @@ command_boot(char *arg)
 		bootit(filename, howto, tell);
 	} else {
 		int i;
+
+#ifndef SMALL
+		bootdefault();
+#endif
 		for (i = 0; i  NUMNAMES; i++) {
 			bootit(names[i][0], howto, tell);
 			bootit(names[i][1], howto, tell);
@@ -504,6 +517,21 @@ command_consdev(char *arg)
 	printf(invalid console device.\n);
 }
 
+#ifndef SMALL
+/* ARGSUSED */
+void
+command_menu(char *arg)
+{
+
+	if (bootconf.nummenu  0) {
+		/* Does not return */
+		doboottypemenu();
+	} else {
+		printf(No menu defined in boot.cfg\n);
+	}
+}
+#endif /* !SMALL */
+
 void
 command_modules(char *arg)
 {

Index: src/sys/arch/i386/stand/lib/bootmenu.c
diff -u src/sys/arch/i386/stand/lib/bootmenu.c:1.10 src/sys/arch/i386/stand/lib/bootmenu.c:1.10.8.1
--- src/sys/arch/i386/stand/lib/bootmenu.c:1.10	Thu Aug 18 13:20:04 2011
+++ src/sys/arch/i386/stand/lib/bootmenu.c	Sat Aug 10 22:42:29 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootmenu.c,v 1.10 2011/08/18 13:20:04 christos Exp $	*/
+/*	$NetBSD: bootmenu.c,v 1.10.8.1 2013/08/10 22:42:29 riz Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -41,6 +41,8 @@
 
 #define isnum(c) ((c) = '0'  (c) = '9')
 
+static void docommandchoice(int);
+
 extern struct x86_boot_params boot_params;
 extern	const char bootprog_name[], bootprog_rev[], bootprog_kernrev[];
 
@@ -297,11 +299,57 @@ getchoicefrominput(char *input, int def)
 	return choice;
 }
 
+static void
+docommandchoice(int choice)
+{
+	char input[80], *ic, *oc;
+
+	ic = bootconf.command[choice];
+	/* Split command string at ; into separate commands */
+	do {
+		oc = input;
+		/* Look for ; separator */
+		for (; *ic  *ic != COMMAND_SEPARATOR; ic++)
+			*oc++ = *ic;
+		if (*input == '\0')
+			continue;
+		/* Strip out any trailing spaces */
+		oc--;
+		for (; *oc == ' '  oc  input; oc--);
+		*++oc = '\0';
+		if (*ic == COMMAND_SEPARATOR)
+			ic++;
+		/* Stop silly command strings like ;;; */
+		if (*input != '\0')
+			docommand(input);
+		/* Skip leading spaces */
+		for (; *ic == ' '; ic++);
+	} while (*ic);
+}
+
+void
+bootdefault(void)
+{
+	int choice;
+	static int entered;
+
+	if (bootconf.nummenu  0) {
+		if (entered) {
+			printf(default boot twice, 

CVS commit: [netbsd-6] src/sys/dev/i2c

2013-08-10 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Aug 10 22:50:56 UTC 2013

Modified Files:
src/sys/dev/i2c [netbsd-6]: files.i2c
Added Files:
src/sys/dev/i2c [netbsd-6]: w83795g.c w83795greg.h

Log Message:
Pull up following revision(s) (requested by matt in ticket #929):
sys/dev/i2c/w83795g.c: revision 1.1
sys/dev/i2c/w83795greg.h: revision 1.1
sys/dev/i2c/files.i2c: revision 1.50
Add driver for Nuvoton W83795G voltage/temp/fan/gpio monitoring device.
As used in the HP Microserver N36L/N40L/N54L:
w83795g* at iic? addr 0x2f
gpio* at gpiobus?
Note that the gpio and watchdog functionality appears to be useless on
the Microserver, as the gpio pins don't affect the LED's and a watchdog
trigger does not cause a reset. Perhaps the reset pin just isn't wired.
There are quite flexible fan control options as well as just monitoring,
but it is not clear to me how best to export that function to userspace.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.6.1 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/dev/i2c/w83795g.c \
src/sys/dev/i2c/w83795greg.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/dev/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.45 src/sys/dev/i2c/files.i2c:1.45.6.1
--- src/sys/dev/i2c/files.i2c:1.45	Fri Nov 18 22:18:08 2011
+++ src/sys/dev/i2c/files.i2c	Sat Aug 10 22:50:56 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.45 2011/11/18 22:18:08 jmcneill Exp $
+#	$NetBSD: files.i2c,v 1.45.6.1 2013/08/10 22:50:56 riz Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -171,3 +171,8 @@ file	dev/i2c/g760a.c			g760a
 device	ibmhawk: sysmon_envsys
 attach	ibmhawk at iic
 file	dev/i2c/ibmhawk.c		ibmhawk
+ 
+# Nuvoton W83795G/ADG Hardware Monitor
+device	w83795g: gpiobus, sysmon_envsys, sysmon_wdog
+attach	w83795g at iic
+file	dev/i2c/w83795g.c 		w83795g

Added files:

Index: src/sys/dev/i2c/w83795g.c
diff -u /dev/null src/sys/dev/i2c/w83795g.c:1.1.2.2
--- /dev/null	Sat Aug 10 22:50:56 2013
+++ src/sys/dev/i2c/w83795g.c	Sat Aug 10 22:50:56 2013
@@ -0,0 +1,452 @@
+/*	$NetBSD: w83795g.c,v 1.1.2.2 2013/08/10 22:50:56 riz Exp $	*/
+
+/*
+ * Copyright (c) 2013 Soren S. Jorvang.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: w83795g.c,v 1.1.2.2 2013/08/10 22:50:56 riz Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/device.h
+#include sys/conf.h
+#include sys/gpio.h
+#include sys/wdog.h
+
+#include dev/i2c/i2cvar.h
+#include dev/gpio/gpiovar.h
+#include dev/sysmon/sysmonvar.h
+
+#include dev/i2c/w83795greg.h
+
+#define NUM_SENSORS 53
+static const struct w83795g_sensor {
+	const char *desc;
+	enum envsys_units type;
+	uint8_t en_reg;
+	uint8_t en_mask;
+	uint8_t en_bits;
+	uint8_t msb;
+} sensors[NUM_SENSORS] = {
+#define _VOLT ENVSYS_SVOLTS_DC
+	{ VSEN1,   _VOLT, W83795G_V_CTRL1, 0x01, 0x01, W83795G_VSEN1 },
+	{ VSEN2,   _VOLT, W83795G_V_CTRL1, 0x02, 0x02, W83795G_VSEN2 },
+	{ VSEN3,   _VOLT, W83795G_V_CTRL1, 0x04, 0x04, W83795G_VSEN3 },
+	{ VSEN4,   _VOLT, W83795G_V_CTRL1, 0x08, 0x08, W83795G_VSEN4 },
+	{ VSEN5,   _VOLT, W83795G_V_CTRL1, 0x10, 0x10, W83795G_VSEN5 },
+	{ VSEN6,   _VOLT, W83795G_V_CTRL1, 0x20, 0x20, W83795G_VSEN6 },
+	{ VSEN7,   _VOLT, W83795G_V_CTRL1, 0x40, 0x40, W83795G_VSEN7 },
+	{ VSEN8,   _VOLT, W83795G_V_CTRL1, 0x80, 0x80, W83795G_VSEN8 },
+	{ VSEN9,   _VOLT, W83795G_V_CTRL2, 0x01, 0x01, W83795G_VSEN9 },
+	{ VSEN10,  _VOLT, W83795G_V_CTRL2, 0x02, 0x02, W83795G_VSEN10 },
+	{ VSEN11,  _VOLT, W83795G_V_CTRL2, 0x04, 0x04, W83795G_VSEN11 },
+	{ VTT, 

CVS commit: [netbsd-6] src/doc

2013-08-10 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Aug 10 22:52:34 UTC 2013

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Tickets 925, 929.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.30 -r1.1.2.31 src/doc/CHANGES-6.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-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.30 src/doc/CHANGES-6.2:1.1.2.31
--- src/doc/CHANGES-6.2:1.1.2.30	Thu Aug  8 21:59:43 2013
+++ src/doc/CHANGES-6.2	Sat Aug 10 22:52:34 2013
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.30 2013/08/08 21:59:43 snj Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.31 2013/08/10 22:52:34 riz Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -474,3 +474,19 @@ sys/netinet6/nd6_rtr.c1.86
 	PR/47576.
 	[msaitoh, ticket #926]
 
+sys/arch/i386/stand/boot/boot2.c		1.59
+sys/arch/i386/stand/lib/bootmenu.c		1.11
+sys/arch/i386/stand/lib/bootmenu.h		1.3
+
+	x86 bootloader changes:  add menu command, and allow
+	default command to be defined in boot.cfg.
+	[he, ticket #925]
+
+sys/dev/i2c/files.i2c1.50 via patch
+sys/dev/i2c/w83795g.c1.1
+sys/dev/i2c/w83795greg.h			1.1
+
+	Add driver for Nuvoton W83795G voltage/temp/fan/gpio monitoring
+	device, as used in the HP Microserver N36L/N40L/N54L.
+	[matt, ticket #929]
+



CVS commit: src/sbin/newfs_udf

2013-08-10 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Sat Aug 10 23:25:35 UTC 2013

Modified Files:
src/sbin/newfs_udf: udf_create.c

Log Message:
Fix tool build under Mac OS X by using gettimeofday(2) instead of
clock_gettime(2). This needs a proper auto-config check.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sbin/newfs_udf/udf_create.c

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

Modified files:

Index: src/sbin/newfs_udf/udf_create.c
diff -u src/sbin/newfs_udf/udf_create.c:1.22 src/sbin/newfs_udf/udf_create.c:1.23
--- src/sbin/newfs_udf/udf_create.c:1.22	Tue Aug  6 13:15:30 2013
+++ src/sbin/newfs_udf/udf_create.c	Sat Aug 10 23:25:35 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_create.c,v 1.22 2013/08/06 13:15:30 reinoud Exp $ */
+/* $NetBSD: udf_create.c,v 1.23 2013/08/10 23:25:35 tron Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include sys/cdefs.h
-__RCSID($NetBSD: udf_create.c,v 1.22 2013/08/06 13:15:30 reinoud Exp $);
+__RCSID($NetBSD: udf_create.c,v 1.23 2013/08/10 23:25:35 tron Exp $);
 
 #include stdio.h
 #include stdlib.h
@@ -646,7 +646,15 @@ udf_set_timestamp_now(struct timestamp *
 {
 	struct timespec now;
 
-	clock_gettime(CLOCK_REALTIME, now);
+#ifdef CLOCK_REALTIME
+	(void)clock_gettime(CLOCK_REALTIME, now);
+#else
+	struct timeval time_of_day;
+
+	(void)gettimeofday(time_of_day, NULL);
+	now.tv_sec = time_of_day.tv_sec;
+	now.tv_nsec = time_of_day.tv_usec * 1000;
+#endif
 	udf_timespec_to_timestamp(now, timestamp);
 }
 



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 23:54:41 UTC 2013

Modified Files:
src/usr.bin/tr: extern.h str.c tr.c

Log Message:
Expose less of the parser state outside str.c.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/tr/extern.h
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/tr/str.c
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/tr/tr.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.bin/tr/extern.h
diff -u src/usr.bin/tr/extern.h:1.7 src/usr.bin/tr/extern.h:1.8
--- src/usr.bin/tr/extern.h:1.7	Tue Sep  6 18:33:46 2011
+++ src/usr.bin/tr/extern.h	Sat Aug 10 23:54:41 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.7 2011/09/06 18:33:46 joerg Exp $	*/
+/*	$NetBSD: extern.h,v 1.8 2013/08/10 23:54:41 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -45,4 +45,4 @@ typedef struct {
 #define	NCHARS	(UCHAR_MAX + 1)		/* Number of possible characters. */
 #define	OOBCH	(UCHAR_MAX + 1)		/* Out of band character value. */
 
-int	 next(STR *);
+int	 next(STR *, int *);

Index: src/usr.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.19 src/usr.bin/tr/str.c:1.20
--- src/usr.bin/tr/str.c:1.19	Thu Sep  8 12:00:26 2011
+++ src/usr.bin/tr/str.c	Sat Aug 10 23:54:41 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.19 2011/09/08 12:00:26 christos Exp $	*/
+/*	$NetBSD: str.c,v 1.20 2013/08/10 23:54:41 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.2 (Berkeley) 4/28/95;
 #endif
-__RCSID($NetBSD: str.c,v 1.19 2011/09/08 12:00:26 christos Exp $);
+__RCSID($NetBSD: str.c,v 1.20 2013/08/10 23:54:41 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -46,6 +46,7 @@ __RCSID($NetBSD: str.c,v 1.19 2011/09/0
 #include stdlib.h
 #include string.h
 #include ctype.h
+#include assert.h
 
 #include extern.h
 
@@ -58,26 +59,29 @@ static int	genrange(STR *);
 static void	genseq(STR *);
 
 int
-next(STR *s)
+next(STR *s, int *ret)
 {
 	int ch;
 
 	switch (s-state) {
 	case EOS:
+		*ret = s-lastch;
 		return 0;
 	case INFINITE:
+		*ret = s-lastch;
 		return 1;
 	case NORMAL:
 		switch (ch = *s-str) {
 		case '\0':
 			s-state = EOS;
+			*ret = s-lastch;
 			return 0;
 		case '\\':
 			s-lastch = backslash(s);
 			break;
 		case '[':
 			if (bracket(s))
-return next(s);
+return next(s, ret);
 			/* FALLTHROUGH */
 		default:
 			++s-str;
@@ -86,30 +90,37 @@ next(STR *s)
 		}
 
 		/* We can start a range at any time. */
-		if (s-str[0] == '-'  genrange(s))
-			return next(s);
+		if (s-str[0] == '-'  genrange(s)) {
+			return next(s, ret);
+		}
+		*ret = s-lastch;
 		return 1;
 	case RANGE:
 		if (s-cnt-- == 0) {
 			s-state = NORMAL;
-			return next(s);
+			return next(s, ret);
 		}
 		++s-lastch;
+		*ret = s-lastch;
 		return 1;
 	case SEQUENCE:
 		if (s-cnt-- == 0) {
 			s-state = NORMAL;
-			return next(s);
+			return next(s, ret);
 		}
+		*ret = s-lastch;
 		return 1;
 	case SET:
 		if ((s-lastch = s-set[s-cnt++]) == OOBCH) {
 			s-state = NORMAL;
-			return next(s);
+			return next(s, ret);
 		}
+		*ret = s-lastch;
 		return 1;
 	}
 	/* NOTREACHED */
+	assert(0);
+	*ret = s-lastch;
 	return 0;
 }
 

Index: src/usr.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.9 src/usr.bin/tr/tr.c:1.10
--- src/usr.bin/tr/tr.c:1.9	Tue Sep  6 18:33:46 2011
+++ src/usr.bin/tr/tr.c	Sat Aug 10 23:54:41 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.9 2011/09/06 18:33:46 joerg Exp $	*/
+/*	$NetBSD: tr.c,v 1.10 2013/08/10 23:54:41 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.9 2011/09/06 18:33:46 joerg Exp $);
+__RCSID($NetBSD: tr.c,v 1.10 2013/08/10 23:54:41 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -96,12 +96,12 @@ __dead static void usage(void);
 int
 main(int argc, char **argv)
 {
-	int ch, cnt, lastch, *p;
+	int ch, ch2, cnt, lastch, *p;
 	int cflag, dflag, sflag, isstring2;
 
 	cflag = dflag = sflag = 0;
 	while ((ch = getopt(argc, argv, cds)) != -1)
-		switch((char)ch) {
+		switch (ch) {
 		case 'c':
 			cflag = 1;
 			break;
@@ -198,20 +198,20 @@ main(int argc, char **argv)
 		for (cnt = NCHARS, p = string1; cnt--;)
 			*p++ = OOBCH;
 
-	if (!next(s2))
+	if (!next(s2, ch2))
 		errx(1, empty string2);
 
 	/* If string2 runs out of characters, use the last one specified. */
 	if (sflag)
-		while (next(s1)) {
-			string1[s1.lastch] = ch = s2.lastch;
-			string2[ch] = 1;
-			(void)next(s2);
+		while (next(s1, ch)) {
+			string1[ch] = ch2;
+			string2[ch2] = 1;
+			(void)next(s2, ch2);
 		}
 	else
-		while (next(s1)) {
-			string1[s1.lastch] = ch = s2.lastch;
-			(void)next(s2);
+		while (next(s1, ch)) {
+			string1[ch] = ch2;
+			(void)next(s2, ch2);
 		}
 
 	if (cflag)
@@ -236,11 +236,12 @@ static void
 setup(int *string, char *arg, STR *str, int 

CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:04:14 UTC 2013

Modified Files:
src/usr.bin/tr: extern.h str.c tr.c

Log Message:
Make the parser state opaque. While here, fix a memory leak when using
the [:foo:] syntax.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/tr/extern.h
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/tr/str.c
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/tr/tr.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.bin/tr/extern.h
diff -u src/usr.bin/tr/extern.h:1.8 src/usr.bin/tr/extern.h:1.9
--- src/usr.bin/tr/extern.h:1.8	Sat Aug 10 23:54:41 2013
+++ src/usr.bin/tr/extern.h	Sun Aug 11 00:04:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.8 2013/08/10 23:54:41 dholland Exp $	*/
+/*	$NetBSD: extern.h,v 1.9 2013/08/11 00:04:14 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -31,18 +31,14 @@
  *	@(#)extern.h	8.1 (Berkeley) 6/6/93
  */
 
-typedef struct {
-	enum { STRING1, STRING2 } which;
-	enum { EOS, INFINITE, NORMAL, RANGE, SEQUENCE, SET } state;
-	int	 cnt;			/* character count */
-	int	 lastch;		/* last character */
-	int	equiv[2];		/* equivalence set */
-	int	*set;			/* set of characters */
-	unsigned char	*str;		/* user's string */
-} STR;
+struct str;
+typedef struct str STR;
 
 #include limits.h
 #define	NCHARS	(UCHAR_MAX + 1)		/* Number of possible characters. */
 #define	OOBCH	(UCHAR_MAX + 1)		/* Out of band character value. */
 
+STR *str_create(int);
+void str_destroy(STR *);
+void str_setstring(STR *s, char *txt);
 int	 next(STR *, int *);

Index: src/usr.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.20 src/usr.bin/tr/str.c:1.21
--- src/usr.bin/tr/str.c:1.20	Sat Aug 10 23:54:41 2013
+++ src/usr.bin/tr/str.c	Sun Aug 11 00:04:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.20 2013/08/10 23:54:41 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.21 2013/08/11 00:04:14 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.2 (Berkeley) 4/28/95;
 #endif
-__RCSID($NetBSD: str.c,v 1.20 2013/08/10 23:54:41 dholland Exp $);
+__RCSID($NetBSD: str.c,v 1.21 2013/08/11 00:04:14 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -50,6 +50,16 @@ __RCSID($NetBSD: str.c,v 1.20 2013/08/1
 
 #include extern.h
 
+struct str {
+	enum { STRING1, STRING2 } which;
+	enum { EOS, INFINITE, NORMAL, RANGE, SEQUENCE, SET } state;
+	int	 cnt;			/* character count */
+	int	 lastch;		/* last character */
+	int	equiv[2];		/* equivalence set */
+	int	*set;			/* set of characters */
+	unsigned char	*str;		/* user's string */
+};
+
 static int	backslash(STR *);
 static int	bracket(STR *);
 static int	c_class(const void *, const void *);
@@ -58,6 +68,43 @@ static void	genequiv(STR *);
 static int	genrange(STR *);
 static void	genseq(STR *);
 
+STR *
+str_create(int whichstring)
+{
+	STR *s;
+
+	s = malloc(sizeof(*s));
+	if (s == NULL) {
+		err(1, Out of memory);
+	}
+
+	s-which = whichstring == 2 ? STRING2 : STRING1;
+	s-state = NORMAL;
+	s-cnt = 0;
+	s-lastch = OOBCH;
+	s-equiv[0] = 0;
+	s-equiv[1] = OOBCH;
+	s-set = NULL;
+	s-str = NULL;
+
+	return s;
+}
+
+void
+str_destroy(STR *s)
+{
+	if (s-set != NULL  s-set != s-equiv) {
+		free(s-set);
+	}
+	free(s);
+}
+
+void
+str_setstring(STR *s, char *txt)
+{
+	s-str = txt;
+}
+
 int
 next(STR *s, int *ret)
 {

Index: src/usr.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.10 src/usr.bin/tr/tr.c:1.11
--- src/usr.bin/tr/tr.c:1.10	Sat Aug 10 23:54:41 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 00:04:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.10 2013/08/10 23:54:41 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.11 2013/08/11 00:04:14 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.10 2013/08/10 23:54:41 dholland Exp $);
+__RCSID($NetBSD: tr.c,v 1.11 2013/08/11 00:04:14 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -87,9 +87,6 @@ static int string1[NCHARS] = {
 	0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 }, string2[NCHARS];
 
-STR s1 = { STRING1, NORMAL, 0, OOBCH, { 0, OOBCH }, NULL, NULL };
-STR s2 = { STRING2, NORMAL, 0, OOBCH, { 0, OOBCH }, NULL, NULL };
-
 static void setup(int *, char *, STR *, int);
 __dead static void usage(void);
 
@@ -98,6 +95,7 @@ main(int argc, char **argv)
 {
 	int ch, ch2, cnt, lastch, *p;
 	int cflag, dflag, sflag, isstring2;
+	STR *s1, *s2;
 
 	cflag = dflag = sflag = 0;
 	while ((ch = getopt(argc, argv, cds)) != -1)
@@ -131,6 +129,9 @@ main(int argc, char **argv)
 		break;
 	}
 
+	s1 = str_create(1);
+	s2 = str_create(2);
+
 	/*
 	 * tr -ds [-c] string1 string2
 	 * Delete all characters (or complemented characters) in string1.
@@ -140,14 +141,16 @@ main(int argc, char **argv)
 		if (!isstring2)
 			usage();
 
-		setup(string1, argv[0], s1, cflag);
-	

CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:05:49 UTC 2013

Modified Files:
src/usr.bin/tr: extern.h str.c tr.c

Log Message:
sprinkle const


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/tr/extern.h
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/tr/str.c
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/tr/tr.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.bin/tr/extern.h
diff -u src/usr.bin/tr/extern.h:1.9 src/usr.bin/tr/extern.h:1.10
--- src/usr.bin/tr/extern.h:1.9	Sun Aug 11 00:04:14 2013
+++ src/usr.bin/tr/extern.h	Sun Aug 11 00:05:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.9 2013/08/11 00:04:14 dholland Exp $	*/
+/*	$NetBSD: extern.h,v 1.10 2013/08/11 00:05:49 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -40,5 +40,5 @@ typedef struct str STR;
 
 STR *str_create(int);
 void str_destroy(STR *);
-void str_setstring(STR *s, char *txt);
+void str_setstring(STR *s, const char *txt);
 int	 next(STR *, int *);

Index: src/usr.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.21 src/usr.bin/tr/str.c:1.22
--- src/usr.bin/tr/str.c:1.21	Sun Aug 11 00:04:14 2013
+++ src/usr.bin/tr/str.c	Sun Aug 11 00:05:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.21 2013/08/11 00:04:14 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.22 2013/08/11 00:05:49 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.2 (Berkeley) 4/28/95;
 #endif
-__RCSID($NetBSD: str.c,v 1.21 2013/08/11 00:04:14 dholland Exp $);
+__RCSID($NetBSD: str.c,v 1.22 2013/08/11 00:05:49 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -57,7 +57,7 @@ struct str {
 	int	 lastch;		/* last character */
 	int	equiv[2];		/* equivalence set */
 	int	*set;			/* set of characters */
-	unsigned char	*str;		/* user's string */
+	unsigned const char *str;	/* user's string */
 };
 
 static int	backslash(STR *);
@@ -100,7 +100,7 @@ str_destroy(STR *s)
 }
 
 void
-str_setstring(STR *s, char *txt)
+str_setstring(STR *s, const char *txt)
 {
 	s-str = txt;
 }
@@ -281,7 +281,7 @@ static int
 genrange(STR *s)
 {
 	int stopval;
-	char *savestart;
+	const char *savestart;
 
 	savestart = s-str;
 	stopval = *++s-str == '\\' ? backslash(s) : *s-str++;

Index: src/usr.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.11 src/usr.bin/tr/tr.c:1.12
--- src/usr.bin/tr/tr.c:1.11	Sun Aug 11 00:04:14 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 00:05:49 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.11 2013/08/11 00:04:14 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.12 2013/08/11 00:05:49 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.11 2013/08/11 00:04:14 dholland Exp $);
+__RCSID($NetBSD: tr.c,v 1.12 2013/08/11 00:05:49 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -87,7 +87,7 @@ static int string1[NCHARS] = {
 	0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
 }, string2[NCHARS];
 
-static void setup(int *, char *, STR *, int);
+static void setup(int *, const char *, STR *, int);
 __dead static void usage(void);
 
 int
@@ -242,7 +242,7 @@ main(int argc, char **argv)
 }
 
 static void
-setup(int *string, char *arg, STR *str, int cflag)
+setup(int *string, const char *arg, STR *str, int cflag)
 {
 	int cnt, *p;
 	int ch;



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:11:46 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
Restore preexisting wrong behavior of tr -c (translates all characters
to the last letter in string2) instead of a different wrong behavior
(translates all characters to 0xff) accidentally just introduced.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/tr/tr.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.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.12 src/usr.bin/tr/tr.c:1.13
--- src/usr.bin/tr/tr.c:1.12	Sun Aug 11 00:05:49 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 00:11:46 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.12 2013/08/11 00:05:49 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.13 2013/08/11 00:11:46 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.12 2013/08/11 00:05:49 dholland Exp $);
+__RCSID($NetBSD: tr.c,v 1.13 2013/08/11 00:11:46 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -223,7 +223,7 @@ main(int argc, char **argv)
 
 	if (cflag)
 		for (cnt = 0, p = string1; cnt  NCHARS; ++p, ++cnt)
-			*p = *p == OOBCH ? ch : cnt;
+			*p = *p == OOBCH ? ch2 : cnt;
 
 	if (sflag)
 		for (lastch = OOBCH; (ch = getchar()) != EOF;) {



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:12:47 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
apply some CSE


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/tr/tr.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.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.13 src/usr.bin/tr/tr.c:1.14
--- src/usr.bin/tr/tr.c:1.13	Sun Aug 11 00:11:46 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 00:12:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.13 2013/08/11 00:11:46 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.14 2013/08/11 00:12:47 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.13 2013/08/11 00:11:46 dholland Exp $);
+__RCSID($NetBSD: tr.c,v 1.14 2013/08/11 00:12:47 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -209,17 +209,13 @@ main(int argc, char **argv)
 		errx(1, empty string2);
 
 	/* If string2 runs out of characters, use the last one specified. */
-	if (sflag)
-		while (next(s1, ch)) {
-			string1[ch] = ch2;
+	while (next(s1, ch)) {
+		string1[ch] = ch2;
+		if (sflag) {
 			string2[ch2] = 1;
-			(void)next(s2, ch2);
-		}
-	else
-		while (next(s1, ch)) {
-			string1[ch] = ch2;
-			(void)next(s2, ch2);
 		}
+		(void)next(s2, ch2);
+	}
 
 	if (cflag)
 		for (cnt = 0, p = string1; cnt  NCHARS; ++p, ++cnt)



CVS commit: src/tests/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:29:22 UTC 2013

Modified Files:
src/tests/usr.bin/tr: t_basic.sh

Log Message:
Remove xfail for PR 48113.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/tr/t_basic.sh

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

Modified files:

Index: src/tests/usr.bin/tr/t_basic.sh
diff -u src/tests/usr.bin/tr/t_basic.sh:1.1 src/tests/usr.bin/tr/t_basic.sh:1.2
--- src/tests/usr.bin/tr/t_basic.sh:1.1	Sat Aug 10 22:36:16 2013
+++ src/tests/usr.bin/tr/t_basic.sh	Sun Aug 11 00:29:21 2013
@@ -1,4 +1,4 @@
-# $NetBSD: t_basic.sh,v 1.1 2013/08/10 22:36:16 dholland Exp $
+# $NetBSD: t_basic.sh,v 1.2 2013/08/11 00:29:21 dholland Exp $
 #
 # Copyright (c) 2013 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -172,11 +172,10 @@ csubst_head() {
 csubst_body() {
 	atf_check -o inline:'abcde\n' -x \
 	'echo abcde | tr -c ''\0-ac-\377' b
-	atf_expect_fail PR bin/48113
-	atf_check -o inline:'QUACK\n' -x \
-	'echo ABCDE | tr -c ''\0-@' QUACK
 	atf_check -o inline:'abcde\n' -x \
 	'echo abcde | tr -c ''\0-ad-\377' bc
+	atf_check -o inline:'QUACK\n' -x \
+	'echo ABCDE | tr -c ''\0-@' QUACK
 }
 
 atf_init_test_cases() {



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:28:46 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
Make tr -c work. Fixes PR 48113.

When -c is in effect, scan string1 first, complement it, and then
iterate over the results while scanning string2. Otherwise, scan
string1 and string2 together as before.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/tr/tr.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.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.14 src/usr.bin/tr/tr.c:1.15
--- src/usr.bin/tr/tr.c:1.14	Sun Aug 11 00:12:47 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 00:28:46 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.14 2013/08/11 00:12:47 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.15 2013/08/11 00:28:46 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.14 2013/08/11 00:12:47 dholland Exp $);
+__RCSID($NetBSD: tr.c,v 1.15 2013/08/11 00:28:46 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -93,7 +93,7 @@ __dead static void usage(void);
 int
 main(int argc, char **argv)
 {
-	int ch, ch2, cnt, lastch, *p;
+	int ch, ch2, lastch;
 	int cflag, dflag, sflag, isstring2;
 	STR *s1, *s2;
 
@@ -198,18 +198,37 @@ main(int argc, char **argv)
 	if (!isstring2)
 		usage();
 
-	str_setstring(s1, argv[0]);
+	if (cflag) {
+		setup(string1, argv[0], s1, cflag);
+		ch = -1;
+	} else {
+		str_setstring(s1, argv[0]);
+	}
 	str_setstring(s2, argv[1]);
 
-	if (cflag)
-		for (cnt = NCHARS, p = string1; cnt--;)
-			*p++ = OOBCH;
-
 	if (!next(s2, ch2))
 		errx(1, empty string2);
 
 	/* If string2 runs out of characters, use the last one specified. */
-	while (next(s1, ch)) {
+	while (1) {
+		if (cflag) {
+			ch++;
+			while (ch  NCHARS  string1[ch] == 0) {
+if (string1[ch] == 0) {
+	string1[ch] = ch;
+}
+ch++;
+			}
+			if (ch == NCHARS) {
+break;
+			}
+		}
+		else {
+			if (!next(s1, ch)) {
+break;
+			}
+		}
+
 		string1[ch] = ch2;
 		if (sflag) {
 			string2[ch2] = 1;
@@ -217,10 +236,6 @@ main(int argc, char **argv)
 		(void)next(s2, ch2);
 	}
 
-	if (cflag)
-		for (cnt = 0, p = string1; cnt  NCHARS; ++p, ++cnt)
-			*p = *p == OOBCH ? ch2 : cnt;
-
 	if (sflag)
 		for (lastch = OOBCH; (ch = getchar()) != EOF;) {
 			ch = string1[ch];
@@ -232,6 +247,7 @@ main(int argc, char **argv)
 	else
 		while ((ch = getchar()) != EOF)
 			(void)putchar(string1[ch]);
+
 	str_destroy(s1);
 	str_destroy(s2);
 	exit (0);



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:34:09 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
Remove silly written-out initialization of string1.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/tr/tr.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.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.15 src/usr.bin/tr/tr.c:1.16
--- src/usr.bin/tr/tr.c:1.15	Sun Aug 11 00:28:46 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 00:34:09 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.15 2013/08/11 00:28:46 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.16 2013/08/11 00:34:09 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.15 2013/08/11 00:28:46 dholland Exp $);
+__RCSID($NetBSD: tr.c,v 1.16 2013/08/11 00:34:09 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -52,40 +52,7 @@ __RCSID($NetBSD: tr.c,v 1.15 2013/08/11
 
 #include extern.h
 
-static int string1[NCHARS] = {
-	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,		/* ASCII */
-	0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-	0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
-	0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
-	0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
-	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
-	0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
-	0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
-	0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
-	0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
-	0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
-	0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
-	0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
-	0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
-	0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
-	0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
-	0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
-	0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
-	0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
-	0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
-	0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
-	0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
-	0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
-	0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
-	0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
-	0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
-	0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
-	0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
-	0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
-	0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
-	0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
-}, string2[NCHARS];
+static int string1[NCHARS], string2[NCHARS];
 
 static void setup(int *, const char *, STR *, int);
 __dead static void usage(void);
@@ -203,6 +170,9 @@ main(int argc, char **argv)
 		ch = -1;
 	} else {
 		str_setstring(s1, argv[0]);
+		for (ch = 0; ch  NCHARS; ch++) {
+			string1[ch] = ch;
+		}
 	}
 	str_setstring(s2, argv[1]);
 



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:39:22 UTC 2013

Modified Files:
src/usr.bin/tr: extern.h str.c tr.c

Log Message:
Simplify the parser handling.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/tr/extern.h
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/tr/str.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/tr/tr.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.bin/tr/extern.h
diff -u src/usr.bin/tr/extern.h:1.10 src/usr.bin/tr/extern.h:1.11
--- src/usr.bin/tr/extern.h:1.10	Sun Aug 11 00:05:49 2013
+++ src/usr.bin/tr/extern.h	Sun Aug 11 00:39:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.10 2013/08/11 00:05:49 dholland Exp $	*/
+/*	$NetBSD: extern.h,v 1.11 2013/08/11 00:39:22 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -38,7 +38,6 @@ typedef struct str STR;
 #define	NCHARS	(UCHAR_MAX + 1)		/* Number of possible characters. */
 #define	OOBCH	(UCHAR_MAX + 1)		/* Out of band character value. */
 
-STR *str_create(int);
+STR *str_create(int, const char *);
 void str_destroy(STR *);
-void str_setstring(STR *s, const char *txt);
 int	 next(STR *, int *);

Index: src/usr.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.22 src/usr.bin/tr/str.c:1.23
--- src/usr.bin/tr/str.c:1.22	Sun Aug 11 00:05:49 2013
+++ src/usr.bin/tr/str.c	Sun Aug 11 00:39:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.22 2013/08/11 00:05:49 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.23 2013/08/11 00:39:22 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.2 (Berkeley) 4/28/95;
 #endif
-__RCSID($NetBSD: str.c,v 1.22 2013/08/11 00:05:49 dholland Exp $);
+__RCSID($NetBSD: str.c,v 1.23 2013/08/11 00:39:22 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -69,7 +69,7 @@ static int	genrange(STR *);
 static void	genseq(STR *);
 
 STR *
-str_create(int whichstring)
+str_create(int whichstring, const char *txt)
 {
 	STR *s;
 
@@ -85,7 +85,7 @@ str_create(int whichstring)
 	s-equiv[0] = 0;
 	s-equiv[1] = OOBCH;
 	s-set = NULL;
-	s-str = NULL;
+	s-str = txt;
 
 	return s;
 }
@@ -99,12 +99,6 @@ str_destroy(STR *s)
 	free(s);
 }
 
-void
-str_setstring(STR *s, const char *txt)
-{
-	s-str = txt;
-}
-
 int
 next(STR *s, int *ret)
 {

Index: src/usr.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.16 src/usr.bin/tr/tr.c:1.17
--- src/usr.bin/tr/tr.c:1.16	Sun Aug 11 00:34:09 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 00:39:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.16 2013/08/11 00:34:09 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.17 2013/08/11 00:39:22 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.16 2013/08/11 00:34:09 dholland Exp $);
+__RCSID($NetBSD: tr.c,v 1.17 2013/08/11 00:39:22 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -54,7 +54,7 @@ __RCSID($NetBSD: tr.c,v 1.16 2013/08/11
 
 static int string1[NCHARS], string2[NCHARS];
 
-static void setup(int *, const char *, STR *, int);
+static void setup(int *, const char *, int, int);
 __dead static void usage(void);
 
 int
@@ -96,9 +96,6 @@ main(int argc, char **argv)
 		break;
 	}
 
-	s1 = str_create(1);
-	s2 = str_create(2);
-
 	/*
 	 * tr -ds [-c] string1 string2
 	 * Delete all characters (or complemented characters) in string1.
@@ -108,16 +105,14 @@ main(int argc, char **argv)
 		if (!isstring2)
 			usage();
 
-		setup(string1, argv[0], s1, cflag);
-		setup(string2, argv[1], s2, 0);
+		setup(string1, argv[0], 1, cflag);
+		setup(string2, argv[1], 2, 0);
 		
 		for (lastch = OOBCH; (ch = getchar()) != EOF;)
 			if (!string1[ch]  (!string2[ch] || lastch != ch)) {
 lastch = ch;
 (void)putchar(ch);
 			}
-		str_destroy(s1);
-		str_destroy(s2);
 		exit(0);
 	}
 
@@ -129,13 +124,11 @@ main(int argc, char **argv)
 		if (isstring2)
 			usage();
 
-		setup(string1, argv[0], s1, cflag);
+		setup(string1, argv[0], 1, cflag);
 
 		while ((ch = getchar()) != EOF)
 			if (!string1[ch])
 (void)putchar(ch);
-		str_destroy(s1);
-		str_destroy(s2);
 		exit(0);
 	}
 
@@ -144,15 +137,13 @@ main(int argc, char **argv)
 	 * Squeeze all characters (or complemented characters) in string1.
 	 */
 	if (sflag  !isstring2) {
-		setup(string1, argv[0], s1, cflag);
+		setup(string1, argv[0], 1, cflag);
 
 		for (lastch = OOBCH; (ch = getchar()) != EOF;)
 			if (!string1[ch] || lastch != ch) {
 lastch = ch;
 (void)putchar(ch);
 			}
-		str_destroy(s1);
-		str_destroy(s2);
 		exit(0);
 	}
 
@@ -166,15 +157,16 @@ main(int argc, char **argv)
 		usage();
 
 	if (cflag) {
-		setup(string1, argv[0], s1, cflag);
+		setup(string1, argv[0], 1, cflag);
+		s1 = NULL; /* for safety */
 		ch = -1;
 	} else {
-		str_setstring(s1, argv[0]);
+		s1 = str_create(1, argv[0]);
 		for (ch = 0; ch  NCHARS; ch++) {
 			

CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:49:15 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
Don't explicitly zero bss variables that are already zeroed.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/tr/tr.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.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.18 src/usr.bin/tr/tr.c:1.19
--- src/usr.bin/tr/tr.c:1.18	Sun Aug 11 00:48:37 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 00:49:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.18 2013/08/11 00:48:37 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.19 2013/08/11 00:49:15 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.18 2013/08/11 00:48:37 dholland Exp $);
+__RCSID($NetBSD: tr.c,v 1.19 2013/08/11 00:49:15 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -264,7 +264,6 @@ setup(int *string, const char *arg, int 
 	STR *str;
 
 	str = str_create(whichstring, arg);
-	memset(string, 0, NCHARS * sizeof(int));
 	while (next(str, ch))
 		string[ch] = 1;
 	if (cflag)



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:48:37 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
Add comments explaining how this works.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/tr/tr.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.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.17 src/usr.bin/tr/tr.c:1.18
--- src/usr.bin/tr/tr.c:1.17	Sun Aug 11 00:39:22 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 00:48:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.17 2013/08/11 00:39:22 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.18 2013/08/11 00:48:37 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.17 2013/08/11 00:39:22 dholland Exp $);
+__RCSID($NetBSD: tr.c,v 1.18 2013/08/11 00:48:37 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -156,24 +156,48 @@ main(int argc, char **argv)
 	if (!isstring2)
 		usage();
 
+	/*
+	 * The first and second strings need to be matched up. This
+	 * means that if we are doing -c, we need to scan the first
+	 * string in advance, complement it, and match *that* against
+	 * the second string; otherwise we need to scan them together.
+	 */
+
 	if (cflag) {
+		/*
+		 * Scan string 1 and complement it. After this,
+		 * string1[] contains 0 for chars to leave alone and 1
+		 * for chars to translate.
+		 */
 		setup(string1, argv[0], 1, cflag);
 		s1 = NULL; /* for safety */
+		/* we will use ch to iterate over string1, so start it */
 		ch = -1;
 	} else {
+		/* Create the scanner for string 1. */
 		s1 = str_create(1, argv[0]);
 		for (ch = 0; ch  NCHARS; ch++) {
 			string1[ch] = ch;
 		}
 	}
+	/* Create the scanner for string 2. */
 	s2 = str_create(2, argv[1]);
 
+	/* Read the first char of string 2 first to make sure there is one. */
 	if (!next(s2, ch2))
 		errx(1, empty string2);
 
-	/* If string2 runs out of characters, use the last one specified. */
+	/*
+	 * Loop over the chars from string 1. After this loop string1[]
+	 * is a mapping from input to output chars.
+	 */
 	while (1) {
 		if (cflag) {
+			/*
+			 * Try each character in order. For characters we
+			 * skip over because we aren't translating them,
+			 * set the translation to the identity.
+			 */
 			ch++;
 			while (ch  NCHARS  string1[ch] == 0) {
 if (string1[ch] == 0) {
@@ -186,18 +210,32 @@ main(int argc, char **argv)
 			}
 		}
 		else {
+			/* Get the next character from string 1. */
 			if (!next(s1, ch)) {
 break;
 			}
 		}
 
+		/* Set the translation to the character from string 2. */
 		string1[ch] = ch2;
+
+		/* Note the characters to squeeze in string2[]. */
 		if (sflag) {
 			string2[ch2] = 1;
 		}
+
+		/*
+		 * Get the next character from string 2. If it runs
+		 * out, this will keep returning the last character
+		 * over and over again.
+		 */
 		(void)next(s2, ch2);
 	}
 
+	/*
+	 * Now do it.
+	 */
+
 	if (sflag)
 		for (lastch = OOBCH; (ch = getchar()) != EOF;) {
 			ch = string1[ch];
@@ -210,6 +248,7 @@ main(int argc, char **argv)
 		while ((ch = getchar()) != EOF)
 			(void)putchar(string1[ch]);
 
+	/* Clean up and exit. */
 	if (s1 != NULL) {
 		str_destroy(s1);
 	}



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:52:17 UTC 2013

Modified Files:
src/usr.bin/tr: str.c

Log Message:
avoid undefined behavior.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/tr/str.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.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.23 src/usr.bin/tr/str.c:1.24
--- src/usr.bin/tr/str.c:1.23	Sun Aug 11 00:39:22 2013
+++ src/usr.bin/tr/str.c	Sun Aug 11 00:52:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.23 2013/08/11 00:39:22 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.24 2013/08/11 00:52:17 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.2 (Berkeley) 4/28/95;
 #endif
-__RCSID($NetBSD: str.c,v 1.23 2013/08/11 00:39:22 dholland Exp $);
+__RCSID($NetBSD: str.c,v 1.24 2013/08/11 00:52:17 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -277,8 +277,8 @@ genrange(STR *s)
 	int stopval;
 	const char *savestart;
 
-	savestart = s-str;
-	stopval = *++s-str == '\\' ? backslash(s) : *s-str++;
+	savestart = s-str++;
+	stopval = *s-str == '\\' ? backslash(s) : *s-str++;
 	if (stopval  (u_char)s-lastch) {
 		s-str = savestart;
 		return 0;



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 01:00:13 UTC 2013

Modified Files:
src/usr.bin/tr: Makefile str.c

Log Message:
Pass -Wpointer-sign.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/tr/Makefile
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/tr/str.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.bin/tr/Makefile
diff -u src/usr.bin/tr/Makefile:1.8 src/usr.bin/tr/Makefile:1.9
--- src/usr.bin/tr/Makefile:1.8	Fri Aug 10 12:10:28 2012
+++ src/usr.bin/tr/Makefile	Sun Aug 11 01:00:13 2013
@@ -1,11 +1,7 @@
-#	$NetBSD: Makefile,v 1.8 2012/08/10 12:10:28 joerg Exp $
+#	$NetBSD: Makefile,v 1.9 2013/08/11 01:00:13 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
 
 PROG=	tr
 SRCS=	str.c tr.c
 
-.for f in str tr
-COPTS.${f}.c+=  -Wno-pointer-sign
-.endfor
-
 .include bsd.prog.mk

Index: src/usr.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.24 src/usr.bin/tr/str.c:1.25
--- src/usr.bin/tr/str.c:1.24	Sun Aug 11 00:52:17 2013
+++ src/usr.bin/tr/str.c	Sun Aug 11 01:00:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.24 2013/08/11 00:52:17 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.25 2013/08/11 01:00:13 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.2 (Berkeley) 4/28/95;
 #endif
-__RCSID($NetBSD: str.c,v 1.24 2013/08/11 00:52:17 dholland Exp $);
+__RCSID($NetBSD: str.c,v 1.25 2013/08/11 01:00:13 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -57,7 +57,7 @@ struct str {
 	int	 lastch;		/* last character */
 	int	equiv[2];		/* equivalence set */
 	int	*set;			/* set of characters */
-	unsigned const char *str;	/* user's string */
+	const char *str;		/* user's string */
 };
 
 static int	backslash(STR *);
@@ -112,7 +112,7 @@ next(STR *s, int *ret)
 		*ret = s-lastch;
 		return 1;
 	case NORMAL:
-		switch (ch = *s-str) {
+		switch (ch = (unsigned char)*s-str) {
 		case '\0':
 			s-state = EOS;
 			*ret = s-lastch;
@@ -261,7 +261,7 @@ genequiv(STR *s)
 		if (*s-str != '=')
 			errx(1, misplaced equivalence equals sign);
 	} else {
-		s-equiv[0] = s-str[0];
+		s-equiv[0] = (unsigned char)s-str[0];
 		if (s-str[1] != '=')
 			errx(1, misplaced equivalence equals sign);
 	}
@@ -278,7 +278,7 @@ genrange(STR *s)
 	const char *savestart;
 
 	savestart = s-str++;
-	stopval = *s-str == '\\' ? backslash(s) : *s-str++;
+	stopval = *s-str == '\\' ? backslash(s) : (unsigned char)*s-str++;
 	if (stopval  (u_char)s-lastch) {
 		s-str = savestart;
 		return 0;
@@ -300,7 +300,7 @@ genseq(STR *s)
 	if (*s-str == '\\')
 		s-lastch = backslash(s);
 	else
-		s-lastch = *s-str++;
+		s-lastch = (unsigned char)*s-str++;
 	if (*s-str != '*')
 		errx(1, misplaced sequence asterisk);
 
@@ -313,7 +313,7 @@ genseq(STR *s)
 		++s-str;
 		break;
 	default:
-		if (isdigit(*s-str)) {
+		if (isdigit((unsigned char)*s-str)) {
 			s-cnt = strtol(s-str, ep, 0);
 			if (*ep == ']') {
 s-str = ep + 1;
@@ -337,7 +337,7 @@ backslash(STR *s)
 	int ch, cnt, val;
 
 	for (cnt = val = 0;;) {
-		ch = *++s-str;
+		ch = (unsigned char)*++s-str;
 		if (!isascii(ch) || !isdigit(ch))
 			break;
 		val = val * 8 + ch - '0';



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 01:29:28 UTC 2013

Modified Files:
src/usr.bin/tr: str.c

Log Message:
Tidy up.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/tr/str.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.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.25 src/usr.bin/tr/str.c:1.26
--- src/usr.bin/tr/str.c:1.25	Sun Aug 11 01:00:13 2013
+++ src/usr.bin/tr/str.c	Sun Aug 11 01:29:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.25 2013/08/11 01:00:13 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.26 2013/08/11 01:29:28 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.2 (Berkeley) 4/28/95;
 #endif
-__RCSID($NetBSD: str.c,v 1.25 2013/08/11 01:00:13 dholland Exp $);
+__RCSID($NetBSD: str.c,v 1.26 2013/08/11 01:29:28 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -63,7 +63,7 @@ struct str {
 static int	backslash(STR *);
 static int	bracket(STR *);
 static int	c_class(const void *, const void *);
-static void	genclass(STR *);
+static void	genclass(STR *, const char *, size_t);
 static void	genequiv(STR *);
 static int	genrange(STR *);
 static void	genseq(STR *);
@@ -112,7 +112,8 @@ next(STR *s, int *ret)
 		*ret = s-lastch;
 		return 1;
 	case NORMAL:
-		switch (ch = (unsigned char)*s-str) {
+		ch = (unsigned char)s-str[0];
+		switch (ch) {
 		case '\0':
 			s-state = EOS;
 			*ret = s-lastch;
@@ -121,8 +122,9 @@ next(STR *s, int *ret)
 			s-lastch = backslash(s);
 			break;
 		case '[':
-			if (bracket(s))
+			if (bracket(s)) {
 return next(s, ret);
+			}
 			/* FALLTHROUGH */
 		default:
 			++s-str;
@@ -137,23 +139,30 @@ next(STR *s, int *ret)
 		*ret = s-lastch;
 		return 1;
 	case RANGE:
-		if (s-cnt-- == 0) {
+		if (s-cnt == 0) {
 			s-state = NORMAL;
 			return next(s, ret);
 		}
+		s-cnt--;
 		++s-lastch;
 		*ret = s-lastch;
 		return 1;
 	case SEQUENCE:
-		if (s-cnt-- == 0) {
+		if (s-cnt == 0) {
 			s-state = NORMAL;
 			return next(s, ret);
 		}
+		s-cnt--;
 		*ret = s-lastch;
 		return 1;
 	case SET:
-		if ((s-lastch = s-set[s-cnt++]) == OOBCH) {
+		s-lastch = s-set[s-cnt++];
+		if (s-lastch == OOBCH) {
 			s-state = NORMAL;
+			if (s-set != s-equiv) {
+free(s-set);
+			}
+			s-set = NULL;
 			return next(s, ret);
 		}
 		*ret = s-lastch;
@@ -168,15 +177,14 @@ next(STR *s, int *ret)
 static int
 bracket(STR *s)
 {
-	char *p;
+	const char *p;
 
 	switch (s-str[1]) {
 	case ':':/* [:class:] */
 		if ((p = strstr(s-str + 2, :])) == NULL)
 			return 0;
-		*p = '\0';
 		s-str += 2;
-		genclass(s);
+		genclass(s, s-str, p - s-str);
 		s-str = p + 2;
 		return 1;
 	case '=':/* [=equiv=] */
@@ -217,36 +225,77 @@ static const CLASS classes[] = {
 	{ xdigit, isxdigit },
 };
 
+typedef struct {
+	const char *name;
+	size_t len;
+} CLASSKEY;
+
 static void
-genclass(STR *s)
+genclass(STR *s, const char *class, size_t len)
 {
-	int cnt;
+	int ch;
 	const CLASS *cp;
-	CLASS tmp;
+	CLASSKEY key;
 	int *p;
+	unsigned pos, num;
 
-	tmp.name = s-str;
-	if ((cp = bsearch(tmp, classes, sizeof(classes) /
-	sizeof(*cp), sizeof(*cp), c_class)) == NULL)
-		errx(1, unknown class %s, s-str);
+	/* Find the class */
+	key.name = class;
+	key.len = len;
+	cp = bsearch(key, classes, __arraycount(classes), sizeof(classes[0]),
+		 c_class);
+	if (cp == NULL) {
+		errx(1, unknown class %.*s, (int)len, class);
+	}
 
-	if ((s-set = p = malloc((NCHARS + 1) * sizeof(*p))) == NULL)
+	/*
+	 * Figure out what characters are in the class
+	 */
+
+	num = NCHARS + 1;
+	p = malloc(num * sizeof(*p));
+	if (p == NULL) {
 		err(1, malloc);
+	}
+
+	pos = 0;
+	for (ch = 0; ch  NCHARS; ch++) {
+		if (cp-func(ch)) {
+			p[pos++] = ch;
+		}
+	}
+
+	p[pos++] = OOBCH;
+	for (; pos  num; pos++) {
+		p[pos] = 0;
+	}
 
-	for (cnt = 0; cnt  NCHARS; ++cnt)
-		if ((*cp-func)(cnt))
-			*p++ = cnt;
-	*p++ = OOBCH;
-	memset(p, 0, NCHARS + 1 - (p - s-set));
+	/* Update the state */
 
+	s-set = p;
 	s-cnt = 0;
 	s-state = SET;
 }
 
 static int
-c_class(const void *a, const void *b)
+c_class(const void *av, const void *bv)
 {
-	return strcmp(((const CLASS *)a)-name, ((const CLASS *)b)-name);
+	const CLASSKEY *a = av;
+	const CLASS *b = bv;
+	size_t blen;
+	int r;
+
+	blen = strlen(b-name);
+	r = strncmp(a-name, b-name, a-len);
+	if (r != 0) {
+		return r;
+	}
+	if (a-len  blen) {
+		/* someone gave us a prefix of the right name */
+		return -1;
+	}
+	assert(a- len == blen);
+	return 0;
 }
 
 /*
@@ -258,12 +307,14 @@ genequiv(STR *s)
 {
 	if (*s-str == '\\') {
 		s-equiv[0] = backslash(s);
-		if (*s-str != '=')
-			errx(1, misplaced equivalence equals sign);
+		if (*s-str != '=') {
+			errx(1, Misplaced equivalence equals sign);
+		}
 	} else {
 		s-equiv[0] = (unsigned char)s-str[0];
-		if (s-str[1] != '=')
-			errx(1, misplaced equivalence equals sign);
+		if (s-str[1] != '=') {
+			

CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 01:42:36 UTC 2013

Modified Files:
src/usr.bin/tr: str.c

Log Message:
Tidy up more. This is pretty ratty code.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/tr/str.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.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.26 src/usr.bin/tr/str.c:1.27
--- src/usr.bin/tr/str.c:1.26	Sun Aug 11 01:29:28 2013
+++ src/usr.bin/tr/str.c	Sun Aug 11 01:42:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.26 2013/08/11 01:29:28 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.27 2013/08/11 01:42:35 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.2 (Berkeley) 4/28/95;
 #endif
-__RCSID($NetBSD: str.c,v 1.26 2013/08/11 01:29:28 dholland Exp $);
+__RCSID($NetBSD: str.c,v 1.27 2013/08/11 01:42:35 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -63,7 +63,7 @@ struct str {
 static int	backslash(STR *);
 static int	bracket(STR *);
 static int	c_class(const void *, const void *);
-static void	genclass(STR *, const char *, size_t);
+static int *genclass(const char *, size_t);
 static void	genequiv(STR *);
 static int	genrange(STR *);
 static void	genseq(STR *);
@@ -178,13 +178,17 @@ static int
 bracket(STR *s)
 {
 	const char *p;
+	int *q;
 
 	switch (s-str[1]) {
 	case ':':/* [:class:] */
 		if ((p = strstr(s-str + 2, :])) == NULL)
 			return 0;
 		s-str += 2;
-		genclass(s, s-str, p - s-str);
+		q = genclass(s-str, p - s-str);
+		s-state = SET;
+		s-set = q;
+		s-cnt = 0;
 		s-str = p + 2;
 		return 1;
 	case '=':/* [=equiv=] */
@@ -230,8 +234,8 @@ typedef struct {
 	size_t len;
 } CLASSKEY;
 
-static void
-genclass(STR *s, const char *class, size_t len)
+static int *
+genclass(const char *class, size_t len)
 {
 	int ch;
 	const CLASS *cp;
@@ -270,11 +274,7 @@ genclass(STR *s, const char *class, size
 		p[pos] = 0;
 	}
 
-	/* Update the state */
-
-	s-set = p;
-	s-cnt = 0;
-	s-state = SET;
+	return p;
 }
 
 static int
@@ -305,13 +305,16 @@ c_class(const void *av, const void *bv)
 static void
 genequiv(STR *s)
 {
-	if (*s-str == '\\') {
+	int ch;
+
+	ch = (unsigned char)s-str[0];
+	if (ch == '\\') {
 		s-equiv[0] = backslash(s);
 		if (*s-str != '=') {
 			errx(1, Misplaced equivalence equals sign);
 		}
 	} else {
-		s-equiv[0] = (unsigned char)s-str[0];
+		s-equiv[0] = ch;
 		if (s-str[1] != '=') {
 			errx(1, Misplaced equivalence equals sign);
 		}
@@ -391,24 +394,36 @@ backslash(STR *s)
 {
 	int ch, cnt, val;
 
-	for (cnt = val = 0;;) {
+	cnt = val = 0;
+	for (;;) {
+		/* Consume the character we're already on. */
 		s-str++;
+
+		/* Look at the next character. */
 		ch = (unsigned char)s-str[0];
 		if (!isascii(ch) || !isdigit(ch)) {
 			break;
 		}
 		val = val * 8 + ch - '0';
 		if (++cnt == 3) {
+			/* Enough digits; consume this one and stop */
 			++s-str;
 			break;
 		}
 	}
 	if (cnt) {
+		/* We saw digits, so return their value */
 		return val;
 	}
-	if (ch != '\0') {
-		++s-str;
+	if (ch == '\0') {
+		/* \end - \ */
+		s-state = EOS;
+		return '\\';
 	}
+
+	/* Consume the escaped character */
+	s-str++;
+
 	switch (ch) {
 	case 'a':			/* escape characters */
 		return '\7';
@@ -426,10 +441,7 @@ backslash(STR *s)
 		return '\t';
 	case 'v':
 		return '\13';
-	case '\0':			/*  \ - \ */
-		s-state = EOS;
-		return '\\';
-	default:			/* \x - x */
+	default:			/* \q - q */
 		return ch;
 	}
 }



CVS commit: src/tests/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 01:50:02 UTC 2013

Modified Files:
src/tests/usr.bin/tr: t_basic.sh

Log Message:
Add some cases pertaining to another bug I just fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/tr/t_basic.sh

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

Modified files:

Index: src/tests/usr.bin/tr/t_basic.sh
diff -u src/tests/usr.bin/tr/t_basic.sh:1.2 src/tests/usr.bin/tr/t_basic.sh:1.3
--- src/tests/usr.bin/tr/t_basic.sh:1.2	Sun Aug 11 00:29:21 2013
+++ src/tests/usr.bin/tr/t_basic.sh	Sun Aug 11 01:50:02 2013
@@ -1,4 +1,4 @@
-# $NetBSD: t_basic.sh,v 1.2 2013/08/11 00:29:21 dholland Exp $
+# $NetBSD: t_basic.sh,v 1.3 2013/08/11 01:50:02 dholland Exp $
 #
 # Copyright (c) 2013 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -57,6 +57,14 @@ dopt_body() {
 	atf_check -o inline:'splice' -x '(echo spl; echo ice) | tr -d ''\n'
 	atf_check -o inline:'splice' -x '(echo spl; echo ice) | tr -d ''\012'
 
+	# see if escape codes work when followed by other things
+	atf_check -o inline:'slice' -x '(echo spl; echo ice) | tr -d ''\n'p
+	atf_check -o inline:'slice' -x '(echo spl; echo ice) | tr -d ''\012'p
+
+	# see if the [=x=] syntax works
+	atf_check -o inline:'abde\n' -x 'echo abcde | tr -d ''[=c=]'
+	atf_check -o inline:'bde\n' -x 'echo abcde | tr -d ''[=c=]'a
+
 	# make sure 0 works
 	# (ignore stderr as dd blabbers to it)
 	atf_check -e ignore -o inline:'ab\n' \



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 01:49:40 UTC 2013

Modified Files:
src/usr.bin/tr: str.c

Log Message:
Fix another bug, relating to parsing the [=x=] syntax.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/tr/str.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.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.27 src/usr.bin/tr/str.c:1.28
--- src/usr.bin/tr/str.c:1.27	Sun Aug 11 01:42:35 2013
+++ src/usr.bin/tr/str.c	Sun Aug 11 01:49:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.27 2013/08/11 01:42:35 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.28 2013/08/11 01:49:40 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.2 (Berkeley) 4/28/95;
 #endif
-__RCSID($NetBSD: str.c,v 1.27 2013/08/11 01:42:35 dholland Exp $);
+__RCSID($NetBSD: str.c,v 1.28 2013/08/11 01:49:40 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -196,6 +196,7 @@ bracket(STR *s)
 			return 0;
 		s-str += 2;
 		genequiv(s);
+		s-str = p + 2;
 		return 1;
 	default:/* [\###*n] or [#*n] */
 		if ((p = strpbrk(s-str + 2, *])) == NULL)
@@ -310,16 +311,19 @@ genequiv(STR *s)
 	ch = (unsigned char)s-str[0];
 	if (ch == '\\') {
 		s-equiv[0] = backslash(s);
-		if (*s-str != '=') {
-			errx(1, Misplaced equivalence equals sign);
-		}
 	} else {
 		s-equiv[0] = ch;
-		if (s-str[1] != '=') {
-			errx(1, Misplaced equivalence equals sign);
-		}
+		s-str++;
+	}
+	if (s-str[0] != '=') {
+		errx(1, Misplaced equivalence equals sign);
 	}
-	s-str += 2;
+	s-str++;
+	if (s-str[0] != ']') {
+		errx(1, Misplaced equivalence right bracket);
+	}
+	s-str++;
+
 	s-cnt = 0;
 	s-state = SET;
 	s-set = s-equiv;



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 01:54:36 UTC 2013

Modified Files:
src/usr.bin/tr: str.c tr.c

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/tr/str.c
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/tr/tr.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.bin/tr/str.c
diff -u src/usr.bin/tr/str.c:1.28 src/usr.bin/tr/str.c:1.29
--- src/usr.bin/tr/str.c:1.28	Sun Aug 11 01:49:40 2013
+++ src/usr.bin/tr/str.c	Sun Aug 11 01:54:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: str.c,v 1.28 2013/08/11 01:49:40 dholland Exp $	*/
+/*	$NetBSD: str.c,v 1.29 2013/08/11 01:54:35 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.2 (Berkeley) 4/28/95;
 #endif
-__RCSID($NetBSD: str.c,v 1.28 2013/08/11 01:49:40 dholland Exp $);
+__RCSID($NetBSD: str.c,v 1.29 2013/08/11 01:54:35 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -53,20 +53,20 @@ __RCSID($NetBSD: str.c,v 1.28 2013/08/1
 struct str {
 	enum { STRING1, STRING2 } which;
 	enum { EOS, INFINITE, NORMAL, RANGE, SEQUENCE, SET } state;
-	int	 cnt;			/* character count */
-	int	 lastch;		/* last character */
-	int	equiv[2];		/* equivalence set */
-	int	*set;			/* set of characters */
+	int cnt;			/* character count */
+	int lastch;			/* last character */
+	int equiv[2];			/* equivalence set */
+	int *set;			/* set of characters */
 	const char *str;		/* user's string */
 };
 
-static int	backslash(STR *);
-static int	bracket(STR *);
-static int	c_class(const void *, const void *);
+static int backslash(STR *);
+static int bracket(STR *);
+static int c_class(const void *, const void *);
 static int *genclass(const char *, size_t);
-static void	genequiv(STR *);
-static int	genrange(STR *);
-static void	genseq(STR *);
+static void genequiv(STR *);
+static int genrange(STR *);
+static void genseq(STR *);
 
 STR *
 str_create(int whichstring, const char *txt)

Index: src/usr.bin/tr/tr.c
diff -u src/usr.bin/tr/tr.c:1.19 src/usr.bin/tr/tr.c:1.20
--- src/usr.bin/tr/tr.c:1.19	Sun Aug 11 00:49:15 2013
+++ src/usr.bin/tr/tr.c	Sun Aug 11 01:54:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: tr.c,v 1.19 2013/08/11 00:49:15 dholland Exp $	*/
+/*	$NetBSD: tr.c,v 1.20 2013/08/11 01:54:35 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = @(#)tr.c	8.2 (Berkeley) 5/4/95;
 #endif
-__RCSID($NetBSD: tr.c,v 1.19 2013/08/11 00:49:15 dholland Exp $);
+__RCSID($NetBSD: tr.c,v 1.20 2013/08/11 01:54:35 dholland Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -107,8 +107,8 @@ main(int argc, char **argv)
 
 		setup(string1, argv[0], 1, cflag);
 		setup(string2, argv[1], 2, 0);
-		
-		for (lastch = OOBCH; (ch = getchar()) != EOF;)
+
+		for (lastch = OOBCH; (ch = getchar()) != EOF; )
 			if (!string1[ch]  (!string2[ch] || lastch != ch)) {
 lastch = ch;
 (void)putchar(ch);



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

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 02:45:56 UTC 2013

Modified Files:
src/sys/arch/arm/arm: blockio.S

Log Message:
Change r12 - ip
Change all condition instructions so they pass unified syntax


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/arm/blockio.S

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/arm/blockio.S
diff -u src/sys/arch/arm/arm/blockio.S:1.5 src/sys/arch/arm/arm/blockio.S:1.6
--- src/sys/arch/arm/arm/blockio.S:1.5	Thu Aug 15 01:38:16 2002
+++ src/sys/arch/arm/arm/blockio.S	Sun Aug 11 02:45:56 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: blockio.S,v 1.5 2002/08/15 01:38:16 briggs Exp $	*/
+/*	$NetBSD: blockio.S,v 1.6 2013/08/11 02:45:56 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Ben Harris.
@@ -48,7 +48,7 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: blockio.S,v 1.5 2002/08/15 01:38:16 briggs Exp $)
+RCSID($NetBSD: blockio.S,v 1.6 2013/08/11 02:45:56 matt Exp $)
 
 /*
  * Read bytes from an I/O address into a block of memory
@@ -65,41 +65,41 @@ ENTRY(read_multi_1)
 	sub	fp, ip, #4
 	subs	r2, r2, #4		/* r2 = length - 4 */
 	blt	.Lrm1_l4			/* less than 4 bytes */
-	ands	r12, r1, #3
+	ands	ip, r1, #3
 	beq	.Lrm1_main		/* aligned destination */
-	rsb	r12, r12, #4
-	cmp	r12, #2
+	rsb	ip, ip, #4
+	cmp	ip, #2
 	ldrb	r3, [r0]
 	strb	r3, [r1], #1
-	ldrgeb	r3, [r0]
-	strgeb	r3, [r1], #1
-	ldrgtb	r3, [r0]
-	strgtb	r3, [r1], #1
-	subs	r2, r2, r12
+	ldrbge	r3, [r0]
+	strbge	r3, [r1], #1
+	ldrbgt	r3, [r0]
+	strbgt	r3, [r1], #1
+	subs	r2, r2, ip
 	blt	.Lrm1_l4
 .Lrm1_main:
 .Lrm1loop:
 	ldrb	r3, [r0]
-	ldrb	r12, [r0]
-	orr	r3, r3, r12, lsl #8
-	ldrb	r12, [r0]
-	orr	r3, r3, r12, lsl #16
-	ldrb	r12, [r0]
-	orr	r3, r3, r12, lsl #24
+	ldrb	ip, [r0]
+	orr	r3, r3, ip, lsl #8
+	ldrb	ip, [r0]
+	orr	r3, r3, ip, lsl #16
+	ldrb	ip, [r0]
+	orr	r3, r3, ip, lsl #24
 	str	r3, [r1], #4
 	subs	r2, r2, #4
 	bge	.Lrm1loop
 .Lrm1_l4:
 	adds	r2, r2, #4			/* r2 = length again */
-	ldmeqdb	fp, {fp, sp, pc}
-	moveq	pc, r14
+	ldmdbeq	fp, {fp, sp, pc}
+	RETc(eq)
 	cmp	r2, #2
 	ldrb	r3, [r0]
 	strb	r3, [r1], #1
-	ldrgeb	r3, [r0]
-	strgeb	r3, [r1], #1
-	ldrgtb	r3, [r0]
-	strgtb	r3, [r1], #1
+	ldrbge	r3, [r0]
+	strbge	r3, [r1], #1
+	ldrbgt	r3, [r0]
+	strbgt	r3, [r1], #1
 	ldmdb	fp, {fp, sp, pc}
 
 /*
@@ -117,17 +117,17 @@ ENTRY(write_multi_1)
 	sub	fp, ip, #4
 	subs	r2, r2, #4		/* r2 = length - 4 */
 	blt	.Lwm1_l4		/* less than 4 bytes */
-	ands	r12, r1, #3
+	ands	ip, r1, #3
 	beq	.Lwm1_main		/* aligned source */
-	rsb	r12, r12, #4
-	cmp	r12, #2
+	rsb	ip, ip, #4
+	cmp	ip, #2
 	ldrb	r3, [r1], #1
 	strb	r3, [r0]
-	ldrgeb	r3, [r1], #1
-	strgeb	r3, [r0]
-	ldrgtb	r3, [r1], #1
-	strgtb	r3, [r0]
-	subs	r2, r2, r12
+	ldrbge	r3, [r1], #1
+	strbge	r3, [r0]
+	ldrbgt	r3, [r1], #1
+	strbgt	r3, [r0]
+	subs	r2, r2, ip
 	blt	.Lwm1_l4
 .Lwm1_main:
 .Lwm1loop:
@@ -143,14 +143,14 @@ ENTRY(write_multi_1)
 	bge	.Lwm1loop
 .Lwm1_l4:
 	adds	r2, r2, #4			/* r2 = length again */
-	ldmeqdb	fp, {fp, sp, pc}
+	ldmdbeq	fp, {fp, sp, pc}
 	cmp	r2, #2
 	ldrb	r3, [r1], #1
 	strb	r3, [r0]
-	ldrgeb	r3, [r1], #1
-	strgeb	r3, [r0]
-	ldrgtb	r3, [r1], #1
-	strgtb	r3, [r0]
+	ldrbge	r3, [r1], #1
+	strbge	r3, [r0]
+	ldrbgt	r3, [r1], #1
+	strbgt	r3, [r0]
 	ldmdb	fp, {fp, sp, pc}
 
 /*



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

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 02:53:18 UTC 2013

Modified Files:
src/sys/arch/arm/arm: bcopyinout_xscale.S

Log Message:
fix conditional instructions to conform to unified syntax
use push/pop
use RET/RETc


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/arm/bcopyinout_xscale.S

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/arm/bcopyinout_xscale.S
diff -u src/sys/arch/arm/arm/bcopyinout_xscale.S:1.7 src/sys/arch/arm/arm/bcopyinout_xscale.S:1.8
--- src/sys/arch/arm/arm/bcopyinout_xscale.S:1.7	Sun Jan 18 01:19:32 2009
+++ src/sys/arch/arm/arm/bcopyinout_xscale.S	Sun Aug 11 02:53:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcopyinout_xscale.S,v 1.7 2009/01/18 01:19:32 bjh21 Exp $	*/
+/*	$NetBSD: bcopyinout_xscale.S,v 1.8 2013/08/11 02:53:18 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -35,7 +35,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-RCSID($NetBSD: bcopyinout_xscale.S,v 1.7 2009/01/18 01:19:32 bjh21 Exp $)	
+RCSID($NetBSD: bcopyinout_xscale.S,v 1.8 2013/08/11 02:53:18 matt Exp $)	
 
 	.text
 	.align	0
@@ -50,9 +50,9 @@ RCSID($NetBSD: bcopyinout_xscale.S,v 1.
 ENTRY(copyin)
 	cmp	r2, #0x00
 	movle	r0, #0x00
-	movle	pc, lr			/* Bail early if length is = 0 */
+	RETc(le)			/* Bail early if length is = 0 */
 
-	stmfd	sp!, {r10-r11, lr}
+	push	{r10-r11, lr}
 
 	GET_CURPCB(r10)
 
@@ -63,14 +63,16 @@ ENTRY(copyin)
 	bl	.Lcopyin_guts
 	str	r11, [r10, #PCB_ONFAULT]
 	mov	r0, #0x00
-	ldmfd	sp!, {r10-r11, pc}
+	pop	{r10-r11, lr}
+	RET
 
 .Lcopyin_fault:
 	str	r11, [r10, #PCB_ONFAULT]
 	cmp	r3, #0x00
-	ldmgtfd	sp!, {r4-r7}		/* r3  0 Restore r4-r7 */
-	ldmltfd	sp!, {r4-r9}		/* r3  0 Restore r4-r9 */
-	ldmfd	sp!, {r10-r11, pc}
+	popgt	{r4-r7}		/* r3  0 Restore r4-r7 */
+	poplt	{r4-r9}		/* r3  0 Restore r4-r9 */
+	pop	{r10-r11, lr}
+	RET
 
 .Lcopyin_guts:
 	pld	[r0]
@@ -91,7 +93,7 @@ ENTRY(copyin)
 	ldrbt	ip, [r0], #0x01
 	strb	ip, [r1], #0x01
 	cmp	r2, #0x00		/* All done? */
-	moveq	pc, lr
+	RETc(eq)
 
 	/* Destination buffer is now word aligned */
 .Lcopyin_wordaligned:
@@ -102,8 +104,8 @@ ENTRY(copyin)
 
 	/* Quad-align the destination buffer */
 	tst	r1, #0x07		/* Already quad aligned? */
-	ldrnet	ip, [r0], #0x04
-	stmfd	sp!, {r4-r9}		/* Free up some registers */
+	ldrtne	ip, [r0], #0x04
+	push	{r4-r9}		/* Free up some registers */
 	mov	r3, #-1			/* Signal restore r4-r9 */
 	tst	r1, #0x07		/* XXX: bug work-around */
 	subne	r2, r2, #0x04
@@ -172,8 +174,8 @@ ENTRY(copyin)
 
 .Lcopyin_w_lessthan128:
 	adds	r2, r2, #0x80		/* Adjust for extra sub */
-	ldmeqfd	sp!, {r4-r9}
-	moveq	pc, lr			/* Return now if done */
+	popeq	{r4-r9}
+	RETc(eq)			/* Return now if done */
 	subs	r2, r2, #0x20
 	blt	.Lcopyin_w_lessthan32
 
@@ -197,8 +199,8 @@ ENTRY(copyin)
 
 .Lcopyin_w_lessthan32:
 	adds	r2, r2, #0x20		/* Adjust for extra sub */
-	ldmeqfd	sp!, {r4-r9}
-	moveq	pc, lr			/* Return now if done */
+	popeq	{r4-r9}
+	RETc(eq)			/* Return now if done */
 
 	and	r4, r2, #0x18
 	rsb	r5, r4, #0x18
@@ -225,24 +227,24 @@ ENTRY(copyin)
 	strd	r4, [r1], #0x08
 
 	/* Less than 8 bytes remaining */
-	ldmfd	sp!, {r4-r9}
-	moveq	pc, lr			/* Return now if done */
+	pop	{r4-r9}
+	RETc(eq)			/* Return now if done */
 	mov	r3, #0x00
 
 .Lcopyin_w_less_than8:
 	subs	r2, r2, #0x04
-	ldrget	ip, [r0], #0x04
+	ldrtge	ip, [r0], #0x04
 	strge	ip, [r1], #0x04
-	moveq	pc, lr			/* Return now if done */
+	RETc(eq)			/* Return now if done */
 	addlt	r2, r2, #0x04
 	ldrbt	ip, [r0], #0x01
 	cmp	r2, #0x02
-	ldrgebt	r2, [r0], #0x01
+	ldrbtge	r2, [r0], #0x01
 	strb	ip, [r1], #0x01
-	ldrgtbt	ip, [r0]
-	strgeb	r2, [r1], #0x01
-	strgtb	ip, [r1]
-	mov	pc, lr
+	ldrbtgt	ip, [r0]
+	strbge	r2, [r1], #0x01
+	strbgt	ip, [r1]
+	RETc(eq)	
 
 /*
  * At this point, it has not been possible to word align both buffers.
@@ -250,7 +252,7 @@ ENTRY(copyin)
  * (r0) is not.
  */
 .Lcopyin_bad_align:
-	stmfd	sp!, {r4-r7}
+	push	{r4-r7}
 	mov	r3, #0x01
 	bic	r0, r0, #0x03
 	cmp	ip, #2
@@ -296,8 +298,8 @@ ENTRY(copyin)
 	bge	.Lcopyin_bad1_loop16
 
 	adds	r2, r2, #0x10 
-	ldmeqfd	sp!, {r4-r7}
-	moveq	pc, lr			/* Return now if done */
+	popeq	{r4-r7}
+	RETc(eq)			/* Return now if done */
 	subs	r2, r2, #0x04
 	sublt	r0, r0, #0x03
 	blt	.Lcopyin_l4
@@ -357,8 +359,8 @@ ENTRY(copyin)
 	bge	.Lcopyin_bad2_loop16
 
 	adds	r2, r2, #0x10 
-	ldmeqfd	sp!, {r4-r7}
-	moveq	pc, lr			/* Return now if done */
+	popeq	{r4-r7}
+	RETc(eq)			/* Return now if done */
 	subs	r2, r2, #0x04
 	sublt	r0, r0, #0x02
 	blt	.Lcopyin_l4
@@ -418,8 +420,8 @@ ENTRY(copyin)
 	bge	.Lcopyin_bad3_loop16
 
 	adds	r2, r2, #0x10 
-	ldmeqfd	sp!, {r4-r7}
-	moveq	pc, lr			/* Return now if done */
+	popeq	{r4-r7}
+	RETc(eq)			/* Return now if done */
 	subs	r2, r2, #0x04
 	sublt	r0, r0, #0x01
 	blt	.Lcopyin_l4
@@ -442,10 +444,10 @@ ENTRY(copyin)
 	sub	r0, r0, #0x01
 
 .Lcopyin_l4:
-	ldmfd	sp!, {r4-r7}
+	pop	{r4-r7}
 	

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

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 03:00:05 UTC 2013

Modified Files:
src/sys/arch/arm/arm: cpu_in_cksum.S

Log Message:
Use unified syntax for conditional instructions
Use RETc/RET


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/arm/cpu_in_cksum.S

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/arm/cpu_in_cksum.S
diff -u src/sys/arch/arm/arm/cpu_in_cksum.S:1.2 src/sys/arch/arm/arm/cpu_in_cksum.S:1.3
--- src/sys/arch/arm/arm/cpu_in_cksum.S:1.2	Sun Jan 27 16:58:05 2008
+++ src/sys/arch/arm/arm/cpu_in_cksum.S	Sun Aug 11 03:00:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_in_cksum.S,v 1.2 2008/01/27 16:58:05 chris Exp $	*/
+/*	$NetBSD: cpu_in_cksum.S,v 1.3 2013/08/11 03:00:05 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include machine/asm.h
-RCSID($NetBSD: cpu_in_cksum.S,v 1.2 2008/01/27 16:58:05 chris Exp $)
+RCSID($NetBSD: cpu_in_cksum.S,v 1.3 2013/08/11 03:00:05 matt Exp $)
 	
 #include assym.h
 
@@ -60,7 +60,7 @@ RCSID($NetBSD: cpu_in_cksum.S,v 1.2 200
  */
 /* LINTSTUB: Func: int cpu_in_cksum(struct mbuf *, int, int, uint32_t) */
 ENTRY(cpu_in_cksum)
-	stmfd	sp!, {r4-r11,lr}
+	push	{r4-r11,lr}
 	
 	mov	r8, r3			/* Accumulate sum in r8 */
 	mov	r9, r1			/* save len in r9 */
@@ -111,7 +111,8 @@ ENTRY(cpu_in_cksum)
 	add	r0, r0, r0, lsr #16
 	and	r0, r0, r1
 	eor	r0, r0, r1
-	ldmfd	sp!, {r4-r11, pc}
+	pop	{r4-r11, lr}
+	RET
 
 .Lin_cksum_whoops:
 	adr	r0, .Lin_cksum_whoops_str
@@ -153,9 +154,9 @@ ASENTRY_NP(L_cksumdata)
 	blt	.Lcksumdata_endgame
 	cmp	r7, #0x02
 	ldrb	r4, [r0], #0x01		/* Fetch 1st byte */
-	ldrgeb	r5, [r0], #0x01		/* Fetch 2nd byte */
+	ldrbge	r5, [r0], #0x01		/* Fetch 2nd byte */
 	movlt	r5, #0x00
-	ldrgtb	r6, [r0], #0x01		/* Fetch 3rd byte */
+	ldrbgt	r6, [r0], #0x01		/* Fetch 3rd byte */
 	movle	r6, #0x00
 	/* Combine the three bytes depending on endianness and alignment */
 #ifdef __ARMEB__
@@ -173,7 +174,7 @@ ASENTRY_NP(L_cksumdata)
 #ifdef __PROG26
 	ldreq	pc, [sp], #4		/* All done? */
 #else
-	moveq	pc, lr			/* All done? */
+	RETc(eq)			/* All done? */
 #endif
 
 	/* Buffer is now word aligned */
@@ -269,7 +270,7 @@ ASENTRY_NP(L_cksumdata)
 #ifdef __PROG26
 	ldreq	pc, [sp], #4
 #else
-	moveq	pc, lr
+	RETc(eq)
 #endif
 	cmp	r1, #0x20
 
@@ -306,7 +307,7 @@ ASENTRY_NP(L_cksumdata)
 #ifdef __PROG26
 	ldreq	pc, [sp], #4
 #else
-	moveq	pc, lr
+	RETc(eq)
 #endif
 
 .Lcksumdata_less_than_32:
@@ -353,16 +354,16 @@ ASENTRY_NP(L_cksumdata)
 #ifdef __PROG26
 	ldreq	pc, [sp], #4
 #else
-	moveq	pc, lr
+	RETc(eq)
 #endif
 
 	/* Deal with 1 to 3 remaining bytes, possibly misaligned */
 .Lcksumdata_endgame:
 	ldrb	r3, [r0]		/* Fetch first byte */
 	cmp	r1, #0x02
-	ldrgeb	r4, [r0, #0x01]		/* Fetch 2nd and 3rd as necessary */
+	ldrbge	r4, [r0, #0x01]		/* Fetch 2nd and 3rd as necessary */
 	movlt	r4, #0x00
-	ldrgtb	r5, [r0, #0x02]
+	ldrbgt	r5, [r0, #0x02]
 	movle	r5, #0x00
 	/* Combine the three bytes depending on endianness and alignment */
 	tst	r0, #0x01
@@ -382,5 +383,5 @@ ASENTRY_NP(L_cksumdata)
 #ifdef __PROG26
 	ldr	pc, [sp], #4
 #else
-	mov	pc, lr
+	RET
 #endif



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

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 03:09:41 UTC 2013

Modified Files:
src/sys/arch/arm/arm: blockio.S

Log Message:
Use push/pop


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/arm/blockio.S

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/arm/blockio.S
diff -u src/sys/arch/arm/arm/blockio.S:1.6 src/sys/arch/arm/arm/blockio.S:1.7
--- src/sys/arch/arm/arm/blockio.S:1.6	Sun Aug 11 02:45:56 2013
+++ src/sys/arch/arm/arm/blockio.S	Sun Aug 11 03:09:41 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: blockio.S,v 1.6 2013/08/11 02:45:56 matt Exp $	*/
+/*	$NetBSD: blockio.S,v 1.7 2013/08/11 03:09:41 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 Ben Harris.
@@ -48,7 +48,7 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: blockio.S,v 1.6 2013/08/11 02:45:56 matt Exp $)
+RCSID($NetBSD: blockio.S,v 1.7 2013/08/11 03:09:41 matt Exp $)
 
 /*
  * Read bytes from an I/O address into a block of memory
@@ -61,7 +61,7 @@ RCSID($NetBSD: blockio.S,v 1.6 2013/08/
 /* This code will look very familiar if you've read _memcpy(). */
 ENTRY(read_multi_1)
 	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
+	push	{fp, ip, lr, pc}
 	sub	fp, ip, #4
 	subs	r2, r2, #4		/* r2 = length - 4 */
 	blt	.Lrm1_l4			/* less than 4 bytes */
@@ -92,7 +92,7 @@ ENTRY(read_multi_1)
 .Lrm1_l4:
 	adds	r2, r2, #4			/* r2 = length again */
 	ldmdbeq	fp, {fp, sp, pc}
-	RETc(eq)
+	RETc(eq)/* ??? not needed */
 	cmp	r2, #2
 	ldrb	r3, [r0]
 	strb	r3, [r1], #1
@@ -113,7 +113,7 @@ ENTRY(read_multi_1)
 /* This code will look very familiar if you've read _memcpy(). */
 ENTRY(write_multi_1)
 	mov	ip, sp
-	stmfd	sp!, {fp, ip, lr, pc}
+	push	{fp, ip, lr, pc}
 	sub	fp, ip, #4
 	subs	r2, r2, #4		/* r2 = length - 4 */
 	blt	.Lwm1_l4		/* less than 4 bytes */
@@ -286,7 +286,7 @@ ENTRY(insw16)
 
 /* Word aligned insw */
 
-	stmfd	sp!, {r4,r5,lr}
+	push	{r4,r5,lr}
 
 .Linsw16loop:
 	ldr	r3, [r0, #0x0002]	/* take advantage of nonaligned
@@ -317,7 +317,7 @@ ENTRY(insw16)
 	subs	r2, r2, #0x0008	/* Next */
 	bgt	.Linsw16loop
 
-	ldmfd	sp!, {r4,r5,pc}		/* Restore regs and go home */
+	pop	{r4,r5,pc}		/* Restore regs and go home */
 
 
 /*
@@ -343,7 +343,7 @@ ENTRY(outsw16)
 
 /* Word aligned outsw */
 
-	stmfd	sp!, {r4,r5,lr}
+	push	{r4,r5,lr}
 
 .Loutsw16loop:
 	ldmia	r1!, {r4,r5,ip,lr}
@@ -384,7 +384,7 @@ ENTRY(outsw16)
 	subs	r2, r2, #0x0008
 	bgt	.Loutsw16loop
 
-	ldmfd	sp!, {r4,r5,pc}		/* and go home */
+	pop	{r4,r5,pc}		/* and go home */
 
 /*
  * reads short ints (16 bits) from an I/O address into a block of memory
@@ -411,7 +411,7 @@ ENTRY(inswm8)
 
 /* Word aligned insw */
 
-	stmfd	sp!, {r4-r9,lr}
+	push	{r4-r9,lr}
 
 	mov	lr, #0xff00
 	orr	lr, lr, #0x00ff
@@ -480,7 +480,7 @@ ENTRY(inswm8)
 
 
 .Linswm8_l1:
-	ldmfd	sp!, {r4-r9,pc}		/* And go home */
+	pop	{r4-r9,pc}		/* And go home */
 
 /*
  * write short ints (16 bits) to an I/O address from a block of memory
@@ -507,7 +507,7 @@ ENTRY(outswm8)
 
 /* Word aligned outsw */
 
-	stmfd	sp!, {r4-r8,lr}
+	push	{r4-r8,lr}
 
 .Loutswm8_loop8:
 	cmp	r2, #8
@@ -584,4 +584,4 @@ ENTRY(outswm8)
 	str	r3, [r0]
 
 .Loutswm8_l1:
-	ldmfd	sp!, {r4-r8,pc}		/* And go home */
+	pop	{r4-r8,pc}		/* And go home */



CVS commit: src/games/ching

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 03:27:02 UTC 2013

Modified Files:
src/games/ching: Makefile.inc

Log Message:
this already passes WARNS=5


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/games/ching/Makefile.inc

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

Modified files:

Index: src/games/ching/Makefile.inc
diff -u src/games/ching/Makefile.inc:1.2 src/games/ching/Makefile.inc:1.3
--- src/games/ching/Makefile.inc:1.2	Thu Jun  4 06:51:11 2009
+++ src/games/ching/Makefile.inc	Sun Aug 11 03:27:02 2013
@@ -1,5 +1,5 @@
-#	$NetBSD: Makefile.inc,v 1.2 2009/06/04 06:51:11 dholland Exp $
+#	$NetBSD: Makefile.inc,v 1.3 2013/08/11 03:27:02 dholland Exp $
 
 CPPFLAGS+=-I${.CURDIR}/../include
 BINDIR?=/usr/games
-WARNS?=4
+WARNS?=5



CVS commit: src/games/rogue

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 03:34:48 UTC 2013

Modified Files:
src/games/rogue: rogue.h

Log Message:
typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/games/rogue/rogue.h

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

Modified files:

Index: src/games/rogue/rogue.h
diff -u src/games/rogue/rogue.h:1.22 src/games/rogue/rogue.h:1.23
--- src/games/rogue/rogue.h:1.22	Fri Aug 26 06:18:17 2011
+++ src/games/rogue/rogue.h	Sun Aug 11 03:34:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rogue.h,v 1.22 2011/08/26 06:18:17 dholland Exp $	*/
+/*	$NetBSD: rogue.h,v 1.23 2013/08/11 03:34:48 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -221,7 +221,7 @@ struct obj {/* comment is monster me
 	unsigned long m_flags;	/* monster flags */
 	const char *damage;		/* damage it does */
 	short quantity;			/* hit points to kill */
-	short ichar;			/* 'A' is for aquatar */
+	short ichar;			/* 'A' is for aquator */
 	short kill_exp;			/* exp for killing it */
 	short is_protected;		/* level starts */
 	short is_cursed;		/* level ends */



CVS commit: src/games/rogue

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 03:44:27 UTC 2013

Modified Files:
src/games/rogue: Makefile monster.c rogue.h

Log Message:
WARNS=5


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/games/rogue/Makefile
cvs rdiff -u -r1.16 -r1.17 src/games/rogue/monster.c
cvs rdiff -u -r1.23 -r1.24 src/games/rogue/rogue.h

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

Modified files:

Index: src/games/rogue/Makefile
diff -u src/games/rogue/Makefile:1.17 src/games/rogue/Makefile:1.18
--- src/games/rogue/Makefile:1.17	Sat Feb  6 23:45:26 2010
+++ src/games/rogue/Makefile	Sun Aug 11 03:44:27 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2010/02/06 23:45:26 he Exp $
+#	$NetBSD: Makefile,v 1.18 2013/08/11 03:44:27 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 
 PROG=	rogue
@@ -11,7 +11,6 @@ LDADD=	-lcurses -lterminfo
 HIDEGAME=hidegame
 SETGIDGAME=yes
 MAN=	rogue.6
-WARNS=	2
 
 .if make(install)
 SUBDIR+=USD.doc

Index: src/games/rogue/monster.c
diff -u src/games/rogue/monster.c:1.16 src/games/rogue/monster.c:1.17
--- src/games/rogue/monster.c:1.16	Mon Oct 19 02:34:40 2009
+++ src/games/rogue/monster.c	Sun Aug 11 03:44:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: monster.c,v 1.16 2009/10/19 02:34:40 dholland Exp $	*/
+/*	$NetBSD: monster.c,v 1.17 2013/08/11 03:44:27 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)monster.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: monster.c,v 1.16 2009/10/19 02:34:40 dholland Exp $);
+__RCSID($NetBSD: monster.c,v 1.17 2013/08/11 03:44:27 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -87,37 +87,39 @@ const char *const m_names[] = {
 	zombie
 };
 
+#define FILL 0,0,0,0,0,0,0,0,0,0,0,0,0,NULL
+
 static object mon_tab[MONSTERS] = {
-	{(ASLEEP|WAKENS|WANDERS|RUSTS),0d0,25,'A',20,9,18,100,0,0,0,0,0},
-	{(ASLEEP|WANDERS|FLITS|FLIES),1d3,10,'B',2,1,8,60,0,0,0,0,0},
-	{(ASLEEP|WANDERS),3d3/2d5,32,'C',15,7,16,85,0,10,0,0,0},
-	{(ASLEEP|WAKENS|FLAMES),4d6/4d9,145,'D',5000,21,126,100,0,90,0,0,0},
-	{(ASLEEP|WAKENS),1d3,11,'E',2,1,7,65,0,0,0,0,0},
-	{(HOLDS|STATIONARY),5d5,73,'F',91,12,126,80,0,0,0,0,0},
+	{(ASLEEP|WAKENS|WANDERS|RUSTS),0d0,25,'A',20,9,18,100,0,0, FILL},
+	{(ASLEEP|WANDERS|FLITS|FLIES),1d3,10,'B',2,1,8,60,0,0, FILL},
+	{(ASLEEP|WANDERS),3d3/2d5,32,'C',15,7,16,85,0,10, FILL},
+	{(ASLEEP|WAKENS|FLAMES),4d6/4d9,145,'D',5000,21,126,100,0,90, FILL},
+	{(ASLEEP|WAKENS),1d3,11,'E',2,1,7,65,0,0, FILL},
+	{(HOLDS|STATIONARY),5d5,73,'F',91,12,126,80,0,0, FILL},
 	{(ASLEEP|WAKENS|WANDERS|FLIES),5d5/5d5,115,'G',
-			2000,20,126,85,0,10,0,0,0},
-	{(ASLEEP|WAKENS|WANDERS),1d3/1d2,15,'H',3,1,10,67,0,0,0,0,0},
-	{(ASLEEP|FREEZES),0d0,15,'I',5,2,11,68,0,0,0,0,0},
-	{(ASLEEP|WANDERS),3d10/4d5,132,'J',3000,21,126,100,0,0,0,0,0},
-	{(ASLEEP|WAKENS|WANDERS|FLIES),1d4,10,'K',2,1,6,60,0,0,0,0,0},
-	{(ASLEEP|STEALS_GOLD),0d0,25,'L',21,6,16,75,0,0,0,0,0},
+			2000,20,126,85,0,10, FILL},
+	{(ASLEEP|WAKENS|WANDERS),1d3/1d2,15,'H',3,1,10,67,0,0, FILL},
+	{(ASLEEP|FREEZES),0d0,15,'I',5,2,11,68,0,0, FILL},
+	{(ASLEEP|WANDERS),3d10/4d5,132,'J',3000,21,126,100,0,0, FILL},
+	{(ASLEEP|WAKENS|WANDERS|FLIES),1d4,10,'K',2,1,6,60,0,0, FILL},
+	{(ASLEEP|STEALS_GOLD),0d0,25,'L',21,6,16,75,0,0, FILL},
 	{(ASLEEP|WAKENS|WANDERS|CONFUSES),4d4/3d7,97,'M',
-			250,18,126,85,0,25,0,0,0},
-	{(ASLEEP|STEALS_ITEM),0d0,25,'N',39,10,19,75,0,100,0,0,0},
-	{(ASLEEP|WANDERS|WAKENS|SEEKS_GOLD),1d6,25,'O',5,4,13,70,0,10,0,0,0},
-	{(ASLEEP|INVISIBLE|WANDERS|FLITS),5d4,76,'P',120,15,24,80,0,50,0,0,0},
-	{(ASLEEP|WAKENS|WANDERS),3d5,30,'Q',20,8,17,78,0,20,0,0,0},
-	{(ASLEEP|WAKENS|WANDERS|STINGS),2d5,19,'R',10,3,12,70,0,0,0,0,0},
-	{(ASLEEP|WAKENS|WANDERS),1d3,8,'S',2,1,9,50,0,0,0,0,0},
-	{(ASLEEP|WAKENS|WANDERS),4d6/1d4,75,'T',125,13,22,75,0,33,0,0,0},
+			250,18,126,85,0,25, FILL},
+	{(ASLEEP|STEALS_ITEM),0d0,25,'N',39,10,19,75,0,100, FILL},
+	{(ASLEEP|WANDERS|WAKENS|SEEKS_GOLD),1d6,25,'O',5,4,13,70,0,10, FILL},
+	{(ASLEEP|INVISIBLE|WANDERS|FLITS),5d4,76,'P',120,15,24,80,0,50, FILL},
+	{(ASLEEP|WAKENS|WANDERS),3d5,30,'Q',20,8,17,78,0,20, FILL},
+	{(ASLEEP|WAKENS|WANDERS|STINGS),2d5,19,'R',10,3,12,70,0,0, FILL},
+	{(ASLEEP|WAKENS|WANDERS),1d3,8,'S',2,1,9,50,0,0, FILL},
+	{(ASLEEP|WAKENS|WANDERS),4d6/1d4,75,'T',125,13,22,75,0,33, FILL},
 	{(ASLEEP|WAKENS|WANDERS),4d10,90,'U',
-			200,17,26,85,0,33,0,0,0},
+			200,17,26,85,0,33, FILL},
 	{(ASLEEP|WAKENS|WANDERS|DRAINS_LIFE),1d14/1d4,55,'V',
-			350,19,126,85,0,18,0,0,0},
-	{(ASLEEP|WANDERS|DROPS_LEVEL),2d8,45,'W',55,14,23,75,0,0,0,0,0},
-	{(ASLEEP|IMITATES),4d6,42,'X',110,16,25,75,0,0,0,0,0},
-	{(ASLEEP|WANDERS),3d6,35,'Y',50,11,20,80,0,20,0,0,0},
-	{(ASLEEP|WAKENS|WANDERS),1d7,21,'Z',8,5,14,69,0,0,0,0,0}
+			350,19,126,85,0,18, FILL},
+	{(ASLEEP|WANDERS|DROPS_LEVEL),2d8,45,'W',55,14,23,75,0,0, FILL},
+	{(ASLEEP|IMITATES),4d6,42,'X',110,16,25,75,0,0, FILL},
+	

CVS commit: src/usr.sbin/dumplfs

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 03:49:24 UTC 2013

Modified Files:
src/usr.sbin/dumplfs: Makefile

Log Message:
Turn off -fno-strict-aliasing for HAVE_GCC; it makes no difference to
the compiler output and is therefore ipso facto not necessary. I'll
leave it on for HAVE_LLVM as I can't check that tonight.

(If there is invalid code in here that actually requires it, let me
know so I can fix things properly.)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/dumplfs/Makefile

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/dumplfs/Makefile
diff -u src/usr.sbin/dumplfs/Makefile:1.15 src/usr.sbin/dumplfs/Makefile:1.16
--- src/usr.sbin/dumplfs/Makefile:1.15	Fri Aug 10 12:10:28 2012
+++ src/usr.sbin/dumplfs/Makefile	Sun Aug 11 03:49:24 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2012/08/10 12:10:28 joerg Exp $
+#	$NetBSD: Makefile,v 1.16 2013/08/11 03:49:24 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 WARNS?=	3	# XXX -Wsign-compare
@@ -10,7 +10,7 @@ SRCS=	dumplfs.c lfs_cksum.c misc.c
 .PATH:	${NETBSDSRCDIR}/sys/ufs/lfs
 MAN=	dumplfs.8
 
-.if defined(HAVE_GCC) || defined(HAVE_LLVM)
+.if defined(HAVE_LLVM)
 COPTS+=	-fno-strict-aliasing
 .endif
 



CVS commit: src/etc/mtree

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 03:53:12 UTC 2013

Modified Files:
src/etc/mtree: NetBSD.dist.tests

Log Message:
more dark ATF rituals are required


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/etc/mtree/NetBSD.dist.tests

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

Modified files:

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.97 src/etc/mtree/NetBSD.dist.tests:1.98
--- src/etc/mtree/NetBSD.dist.tests:1.97	Fri Jul 19 04:00:40 2013
+++ src/etc/mtree/NetBSD.dist.tests	Sun Aug 11 03:53:12 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.97 2013/07/19 04:00:40 kefren Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.98 2013/08/11 03:53:12 dholland Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -361,6 +361,7 @@
 ./usr/tests/usr.bin/shmif_dumpbus
 ./usr/tests/usr.bin/sort
 ./usr/tests/usr.bin/tmux
+./usr/tests/usr.bin/tr
 ./usr/tests/usr.bin/unifdef
 ./usr/tests/usr.bin/xlint
 ./usr/tests/usr.bin/xlint/lint1



CVS commit: src/sys/ufs

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 04:36:17 UTC 2013

Modified Files:
src/sys/ufs/ext2fs: ext2fs_vfsops.c
src/sys/ufs/ffs: ffs_vfsops.c
src/sys/ufs/ufs: ufs_vnops.c ufsmount.h

Log Message:
Kill off uo_unmark_vnode/UFS_UNMARK_VNODE as it's now a leftover.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/ufs/ext2fs/ext2fs_vfsops.c
cvs rdiff -u -r1.286 -r1.287 src/sys/ufs/ffs/ffs_vfsops.c
cvs rdiff -u -r1.216 -r1.217 src/sys/ufs/ufs/ufs_vnops.c
cvs rdiff -u -r1.40 -r1.41 src/sys/ufs/ufs/ufsmount.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/ufs/ext2fs/ext2fs_vfsops.c
diff -u src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.171 src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.172
--- src/sys/ufs/ext2fs/ext2fs_vfsops.c:1.171	Sun Jun 23 02:06:05 2013
+++ src/sys/ufs/ext2fs/ext2fs_vfsops.c	Sun Aug 11 04:36:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs_vfsops.c,v 1.171 2013/06/23 02:06:05 dholland Exp $	*/
+/*	$NetBSD: ext2fs_vfsops.c,v 1.172 2013/08/11 04:36:17 dholland Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1994
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ext2fs_vfsops.c,v 1.171 2013/06/23 02:06:05 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ext2fs_vfsops.c,v 1.172 2013/08/11 04:36:17 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_compat_netbsd.h
@@ -159,7 +159,6 @@ static const struct ufs_ops ext2fs_ufsop
 	.uo_itimes = ext2fs_itimes,
 	.uo_update = ext2fs_update,
 	.uo_vfree = ext2fs_vfree,
-	.uo_unmark_vnode = (void (*)(vnode_t *))nullop,
 };
 
 /* Fill in the inode uid/gid from ext2 halves.  */

Index: src/sys/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.286 src/sys/ufs/ffs/ffs_vfsops.c:1.287
--- src/sys/ufs/ffs/ffs_vfsops.c:1.286	Sun Jun 23 22:03:34 2013
+++ src/sys/ufs/ffs/ffs_vfsops.c	Sun Aug 11 04:36:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.286 2013/06/23 22:03:34 dholland Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.287 2013/08/11 04:36:17 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.286 2013/06/23 22:03:34 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.287 2013/08/11 04:36:17 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -173,7 +173,6 @@ static const struct ufs_ops ffs_ufsops =
 	.uo_valloc = ffs_valloc,
 	.uo_vfree = ffs_vfree,
 	.uo_balloc = ffs_balloc,
-	.uo_unmark_vnode = (void (*)(vnode_t *))nullop,
 	.uo_snapgone = ffs_snapgone,
 };
 

Index: src/sys/ufs/ufs/ufs_vnops.c
diff -u src/sys/ufs/ufs/ufs_vnops.c:1.216 src/sys/ufs/ufs/ufs_vnops.c:1.217
--- src/sys/ufs/ufs/ufs_vnops.c:1.216	Sun Jun 16 00:13:58 2013
+++ src/sys/ufs/ufs/ufs_vnops.c	Sun Aug 11 04:36:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_vnops.c,v 1.216 2013/06/16 00:13:58 dholland Exp $	*/
+/*	$NetBSD: ufs_vnops.c,v 1.217 2013/08/11 04:36:17 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ufs_vnops.c,v 1.216 2013/06/16 00:13:58 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: ufs_vnops.c,v 1.217 2013/08/11 04:36:17 dholland Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -1117,8 +1117,6 @@ ufs_mkdir(void *v)
 		ip-i_nlink = 0;
 		DIP_ASSIGN(ip, nlink, 0);
 		ip-i_flag |= IN_CHANGE;
-		/* If IN_ADIROP, account for it */
-		UFS_UNMARK_VNODE(tvp);
 		UFS_WAPBL_UPDATE(tvp, NULL, NULL, UPDATE_DIROP);
 		UFS_WAPBL_END(dvp-v_mount);
 		vput(tvp);
@@ -1912,8 +1910,6 @@ ufs_makeinode(int mode, struct vnode *dv
 	ip-i_nlink = 0;
 	DIP_ASSIGN(ip, nlink, 0);
 	ip-i_flag |= IN_CHANGE;
-	/* If IN_ADIROP, account for it */
-	UFS_UNMARK_VNODE(tvp);
 	UFS_WAPBL_UPDATE(tvp, NULL, NULL, 0);
 	tvp-v_type = VNON;		/* explodes later if VBLK */
 	UFS_WAPBL_END1(dvp-v_mount, dvp);

Index: src/sys/ufs/ufs/ufsmount.h
diff -u src/sys/ufs/ufs/ufsmount.h:1.40 src/sys/ufs/ufs/ufsmount.h:1.41
--- src/sys/ufs/ufs/ufsmount.h:1.40	Sun Jun 16 13:33:30 2013
+++ src/sys/ufs/ufs/ufsmount.h	Sun Aug 11 04:36:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufsmount.h,v 1.40 2013/06/16 13:33:30 hannken Exp $	*/
+/*	$NetBSD: ufsmount.h,v 1.41 2013/08/11 04:36:17 dholland Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -138,7 +138,6 @@ struct ufs_ops {
 	int (*uo_vfree)(struct vnode *, ino_t, int);
 	int (*uo_balloc)(struct vnode *, off_t, int, kauth_cred_t, int,
 	struct buf **);
-void (*uo_unmark_vnode)(struct vnode *);
 void (*uo_snapgone)(struct vnode *);
 };
 
@@ -156,8 +155,6 @@ struct ufs_ops {
 	(*UFS_OPS(vp)-uo_vfree)((vp), (ino), (mode))
 #define	UFS_BALLOC(vp, off, size, cr, flags, bpp) \
 	(*UFS_OPS(vp)-uo_balloc)((vp), (off), (size), (cr), (flags), (bpp))
-#define	UFS_UNMARK_VNODE(vp) \
-	(*UFS_OPS(vp)-uo_unmark_vnode)((vp))
 #define	

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

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 04:39:18 UTC 2013

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

Log Message:
Switch to unified syntax
use it to get condition return on thumb


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/include/asm.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/asm.h
diff -u src/sys/arch/arm/include/asm.h:1.18 src/sys/arch/arm/include/asm.h:1.19
--- src/sys/arch/arm/include/asm.h:1.18	Wed Aug  7 17:09:50 2013
+++ src/sys/arch/arm/include/asm.h	Sun Aug 11 04:39:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.18 2013/08/07 17:09:50 matt Exp $	*/
+/*	$NetBSD: asm.h,v 1.19 2013/08/11 04:39:18 matt Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -39,6 +39,8 @@
 
 #include arm/cdefs.h
 
+	.syntax		unified
+
 #define	__BIT(n)	(1  (n))
 #define __BITS(hi,lo)	((~((~0)((hi)+1)))((~0)(lo)))
 
@@ -54,7 +56,7 @@
 #endif
 
 #ifndef _ALIGN_TEXT
-# define _ALIGN_TEXT .align 0
+# define _ALIGN_TEXT .align 2
 #endif
 
 /*
@@ -171,7 +173,11 @@
 #if defined (_ARM_ARCH_4T)
 # define RET		bx		lr
 # define RETr(r)	bx		r
-# define RETc(c)	__CONCAT(bx,c)	lr
+# if defined(__thumb__)
+#  define RETc(c)	it c; __CONCAT(bx,c)	lr
+# else
+#  define RETc(c)	__CONCAT(bx,c)	lr
+# endif
 #else
 # define RET		mov		pc, lr
 # define RETr(r)	mov		pc, r



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

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 04:40:06 UTC 2013

Modified Files:
src/sys/arch/arm/arm: lock_cas.S

Log Message:
unified syntax, make it play nice with thumb


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/arm/lock_cas.S

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/arm/lock_cas.S
diff -u src/sys/arch/arm/arm/lock_cas.S:1.9 src/sys/arch/arm/arm/lock_cas.S:1.10
--- src/sys/arch/arm/arm/lock_cas.S:1.9	Fri Aug 31 23:42:34 2012
+++ src/sys/arch/arm/arm/lock_cas.S	Sun Aug 11 04:40:05 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_cas.S,v 1.9 2012/08/31 23:42:34 matt Exp $	*/
+/*	$NetBSD: lock_cas.S,v 1.10 2013/08/11 04:40:05 matt Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -108,8 +108,8 @@ STRONG_ALIAS(atomic_cas_ptr_ni,_lock_cas
 #endif /* !_ARM_ARCH_6 */
 
 #ifdef __PROG32
-#define SAVE_REGS	stmfd	sp!, {r4-r5}
-#define RESTORE_REGS	ldmfd	sp!, {r4-r5}
+#define SAVE_REGS	push	{r4-r5}
+#define RESTORE_REGS	pop	{r4-r5}
 #else
 /* Need to save R14_svc because it'll get trampled if we take a page fault. */
 #define SAVE_REGS	stmfd	sp!, {r4-r6, r14}
@@ -126,32 +126,29 @@ ENTRY(ucas_32)
 	str	r5, [r4, #PCB_ONFAULT]
 
 	.globl	_C_LABEL(ucas_32_ras_start)
+	mov	ip, r0
 _C_LABEL(ucas_32_ras_start):
-#ifdef MULTIPROCESSOR
-1:	ldrex	r5, [r0]		/* we should have access */
+#if defined(MULTIPROCESSOR) || defined(_ARM_ARCH_6)
+1:	ldrex	r5, [ip]		/* we should have access */
 	cmp	r1, r5
 	bne	2f
-	strex	ip, r2, [r0]
-	cmp	ip, #0
+	strex	r0, r2, [ip]
+	cmp	r0, #0
 	bne	1b
 2:
 #else
-	ldrt	r5, [r0]
+	ldrt	r5, [ip]
 	cmp	r1, r5
-	streqt	r2, [r0]
+	strteq	r2, [ip]
+	mov	r0, #0
 #endif
 	.globl _C_LABEL(ucas_32_ras_end)
 _C_LABEL(ucas_32_ras_end):
 
 	str	r5, [r3]
-	mov	r0, #0
-	str	r0, [r4, #PCB_ONFAULT]
-	RESTORE_REGS
-	RET
-
 .Lucasfault:
-	mov	r5, #0
-	str	r5, [r4, #PCB_ONFAULT]
+	movs	r3, #0
+	str	r3, [r4, #PCB_ONFAULT]
 	RESTORE_REGS
 	RET
 END(ucas_32)



CVS commit: src/usr.bin/make

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 04:40:58 UTC 2013

Modified Files:
src/usr.bin/make: make.1

Log Message:
Document .PATH.suffix:. Noted by apb back in December of 2008
(that's how long my queue is...)


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/usr.bin/make/make.1

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/make.1
diff -u src/usr.bin/make/make.1:1.220 src/usr.bin/make/make.1:1.221
--- src/usr.bin/make/make.1:1.220	Tue Jul 30 19:09:57 2013
+++ src/usr.bin/make/make.1	Sun Aug 11 04:40:58 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: make.1,v 1.220 2013/07/30 19:09:57 sjg Exp $
+.\	$NetBSD: make.1,v 1.221 2013/08/11 04:40:58 dholland Exp $
 .\
 .\ Copyright (c) 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -1971,6 +1971,12 @@ If the source is the special
 .Ic .DOTLAST
 target, then the current working
 directory is searched last.
+.It Ic .PATH.suffix
+Like
+.Ic .PATH
+but applies only to files with a particular suffix.
+The suffix must have been previously declared with
+.Ic .SUFFIXES .
 .It Ic .PHONY
 Apply the
 .Ic .PHONY



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 04:41:17 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_add_32.S atomic_add_64.S
atomic_and_32.S atomic_and_64.S atomic_dec_32.S atomic_dec_64.S
atomic_inc_32.S atomic_inc_64.S atomic_or_32.S atomic_or_64.S
atomic_swap.S

Log Message:
Use foo{s} since it reduces the ifdefs for thumb


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/atomic/atomic_add_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_and_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_or_32.S
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_swap.S
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_inc_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_or_64.S
cvs rdiff -u -r1.7 -r1.8 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/atomic/atomic_add_32.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_add_32.S:1.4 src/common/lib/libc/arch/arm/atomic/atomic_add_32.S:1.5
--- src/common/lib/libc/arch/arm/atomic/atomic_add_32.S:1.4	Sat Aug 10 19:59:21 2013
+++ src/common/lib/libc/arch/arm/atomic/atomic_add_32.S	Sun Aug 11 04:41:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_add_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $	*/
+/*	$NetBSD: atomic_add_32.S,v 1.5 2013/08/11 04:41:17 matt Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 ENTRY_NP(_atomic_add_32)
 1:	ldrex	r3, [r0]		/* load old value */
-	add	r3, r3, r1		/* calculate new value */
+	adds	r3, r3, r1		/* calculate new value */
 	strex	r2, r3, [r0]		/* try to store */
 	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again */
@@ -58,7 +58,7 @@ STRONG_ALIAS(_atomic_add_ptr,_atomic_add
 ENTRY_NP(_atomic_add_32_nv)
 	mov	ip, r0			/* need r0 for return value */
 1:	ldrex	r0, [ip]		/* load old value */
-	add	r0, r0, r1		/* calculate new value (return value) */
+	adds	r0, r0, r1		/* calculate new value (return value) */
 	strex	r2, r0, [ip]		/* try to store */
 	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again? */
Index: src/common/lib/libc/arch/arm/atomic/atomic_and_32.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_and_32.S:1.4 src/common/lib/libc/arch/arm/atomic/atomic_and_32.S:1.5
--- src/common/lib/libc/arch/arm/atomic/atomic_and_32.S:1.4	Sat Aug 10 19:59:21 2013
+++ src/common/lib/libc/arch/arm/atomic/atomic_and_32.S	Sun Aug 11 04:41:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_and_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $	*/
+/*	$NetBSD: atomic_and_32.S,v 1.5 2013/08/11 04:41:17 matt Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 ENTRY_NP(_atomic_and_32)
 1:	ldrex	r3, [r0]		/* load old value (to be returned) */
-	and	r3, r3, r1		/* calculate new value */
+	ands	r3, r3, r1		/* calculate new value */
 	strex	r2, r3, [r0]		/* try to store */
 	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again */
@@ -54,10 +54,10 @@ STRONG_ALIAS(_atomic_and_uint,_atomic_an
 STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32)
 
 ENTRY_NP(_atomic_and_32_nv)
-	mov	r3, r0			/* need r0 for return value */
-1:	ldrex	r0, [r3]		/* load old value */
-	and	r0, r0, r1		/* calculate new value (return value) */
-	strex	r2, r0, [r3]		/* try to store */
+	mov	ip, r0			/* need r0 for return value */
+1:	ldrex	r0, [ip]		/* load old value */
+	ands	r0, r0, r1		/* calculate new value (return value) */
+	strex	r2, r0, [ip]		/* try to store */
 	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again? */
 #ifdef _ARM_ARCH_7
Index: src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S
diff -u src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S:1.4 src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S:1.5
--- src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S:1.4	Sat Aug 10 19:59:21 2013
+++ src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S	Sun Aug 11 04:41:17 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_dec_32.S,v 1.4 2013/08/10 19:59:21 matt Exp $	*/
+/*	$NetBSD: atomic_dec_32.S,v 1.5 2013/08/11 04:41:17 matt Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 
 ENTRY_NP(_atomic_dec_32)
 1:	ldrex	r3, [r0]		/* load old value (return value) */
-	sub	r3, r3, #1		/* calculate new value */
+	subs	r3, r3, #1		/* calculate new value */
 	strex	r2, r3, [r0]		/* try to store */
 	cmp	r2, #0			/*   succeed? */
 	bne	1b			/* no, try again? */
@@ -57,7 +57,7 @@ STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec
 ENTRY_NP(_atomic_dec_32_nv)
 	mov	ip, r0			/* need r0 for 

CVS commit: src/common/lib/libc/arch/arm/string

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 04:56:32 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/string: memcmp.S memcpy_arm.S
memcpy_xscale.S memmove.S memset.S strcpy_arm.S strrchr_arm.S

Log Message:
Switch to unified syntax
use RET/RETc
use push/pop


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/arch/arm/string/memcmp.S
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/string/memcpy_arm.S \
src/common/lib/libc/arch/arm/string/memset.S \
src/common/lib/libc/arch/arm/string/strrchr_arm.S
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/string/memcpy_xscale.S \
src/common/lib/libc/arch/arm/string/strcpy_arm.S
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/string/memmove.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/string/memcmp.S
diff -u src/common/lib/libc/arch/arm/string/memcmp.S:1.1 src/common/lib/libc/arch/arm/string/memcmp.S:1.2
--- src/common/lib/libc/arch/arm/string/memcmp.S:1.1	Tue Dec 20 19:28:49 2005
+++ src/common/lib/libc/arch/arm/string/memcmp.S	Sun Aug 11 04:56:32 2013
@@ -1,4 +1,4 @@
-/*  $NetBSD: memcmp.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */
+/*  $NetBSD: memcmp.S,v 1.2 2013/08/11 04:56:32 matt Exp $ */
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -64,7 +64,7 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: memcmp.S,v 1.1 2005/12/20 19:28:49 christos Exp $)
+RCSID($NetBSD: memcmp.S,v 1.2 2013/08/11 04:56:32 matt Exp $)
 
 ENTRY(memcmp)
 	mov	ip, r0
@@ -76,7 +76,7 @@ ENTRY(memcmp)
 
 	/* Are both addresses aligned the same way? */
 	cmp	r2, #0x00
-	eornes	r3, ip, r1
+	eorsne	r3, ip, r1
 	RETc(eq)			/* len == 0, or same addresses! */
 	tst	r3, #0x03
 	subne	r2, r2, #0x01
@@ -157,23 +157,23 @@ ENTRY(memcmp)
 	ldrb	r0, [ip, #0x00]		/* r0 = b1#0 */
 	ldrb	r2, [r1, #0x01]		/* r2 = b2#1 */
 	subs	r0, r0, r3		/* r0 = b1#0 - b2#0 */
-	ldreqb	r3, [ip, #0x01]		/* r3 = b1#1 */
+	ldrbeq	r3, [ip, #0x01]		/* r3 = b1#1 */
 	RETc(ne)			/* Return if mismatch on #0 */
 	subs	r0, r3, r2		/* r0 = b1#1 - b2#1 */
-	ldreqb	r3, [r1, #0x02]		/* r3 = b2#2 */
-	ldreqb	r0, [ip, #0x02]		/* r0 = b1#2 */
+	ldrbeq	r3, [r1, #0x02]		/* r3 = b2#2 */
+	ldrbeq	r0, [ip, #0x02]		/* r0 = b1#2 */
 	RETc(ne)			/* Return if mismatch on #1 */
 	ldrb	r2, [r1, #0x03]		/* r2 = b2#3 */
 	subs	r0, r0, r3		/* r0 = b1#2 - b2#2 */
-	ldreqb	r3, [ip, #0x03]		/* r3 = b1#3 */
+	ldrbeq	r3, [ip, #0x03]		/* r3 = b1#3 */
 	RETc(ne)			/* Return if mismatch on #2 */
 	subs	r0, r3, r2		/* r0 = b1#3 - b2#3 */
-	ldreqb	r3, [r1, #0x04]		/* r3 = b2#4 */
-	ldreqb	r0, [ip, #0x04]		/* r0 = b1#4 */
+	ldrbeq	r3, [r1, #0x04]		/* r3 = b2#4 */
+	ldrbeq	r0, [ip, #0x04]		/* r0 = b1#4 */
 	RETc(ne)			/* Return if mismatch on #3 */
 	ldrb	r2, [r1, #0x05]		/* r2 = b2#5 */
 	subs	r0, r0, r3		/* r0 = b1#4 - b2#4 */
-	ldreqb	r3, [ip, #0x05]		/* r3 = b1#5 */
+	ldrbeq	r3, [ip, #0x05]		/* r3 = b1#5 */
 	RETc(ne)			/* Return if mismatch on #4 */
 	sub	r0, r3, r2		/* r0 = b1#5 - b2#5 */
 	RET

Index: src/common/lib/libc/arch/arm/string/memcpy_arm.S
diff -u src/common/lib/libc/arch/arm/string/memcpy_arm.S:1.3 src/common/lib/libc/arch/arm/string/memcpy_arm.S:1.4
--- src/common/lib/libc/arch/arm/string/memcpy_arm.S:1.3	Mon Jan 28 06:23:44 2013
+++ src/common/lib/libc/arch/arm/string/memcpy_arm.S	Sun Aug 11 04:56:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: memcpy_arm.S,v 1.3 2013/01/28 06:23:44 matt Exp $	*/
+/*	$NetBSD: memcpy_arm.S,v 1.4 2013/08/11 04:56:32 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@ STRONG_ALIAS(__aeabi_memcpy, memcpy)
 /* LINTSTUB: Func: void *memcpy(void *dst, const void *src, size_t len) */
 ENTRY(memcpy)
 	/* save leaf functions having to store this away */
-	stmdb	sp!, {r0, lr}		/* memcpy() returns dest addr */
+	push	{r0, lr}		/* memcpy() returns dest addr */
 
 	subs	r2, r2, #4
 	blt	.Lmemcpy_l4		/* less than 4 bytes */
@@ -82,7 +82,7 @@ ENTRY(memcpy)
 	blt	.Lmemcpy_l12		/* less than 12 bytes (4 from above) */
 	subs	r2, r2, #0x14
 	blt	.Lmemcpy_l32		/* less than 32 bytes (12 from above) */
-	stmdb	sp!, {r4}		/* borrow r4 */
+	push	{r4}		/* borrow r4 */
 
 	/* blat 32 bytes at a time */
 	/* XXX for really big copies perhaps we should use more registers */
@@ -95,19 +95,19 @@ ENTRY(memcpy)
 	bge	.Lmemcpy_loop32
 
 	cmn	r2, #0x10
-	ldmgeia	r1!, {r3, r4, r12, lr}	/* blat a remaining 16 bytes */
-	stmgeia	r0!, {r3, r4, r12, lr}
+	ldmiage	r1!, {r3, r4, r12, lr}	/* blat a remaining 16 bytes */
+	stmiage	r0!, {r3, r4, r12, lr}
 	subge	r2, r2, #0x10
-	ldmia	sp!, {r4}		/* return r4 */
+	pop	{r4}		/* return r4 */
 
 .Lmemcpy_l32:
 	adds	r2, r2, #0x14
 
 	/* blat 12 bytes at a time */
 .Lmemcpy_loop12:
-	ldmgeia	r1!, {r3, r12, lr}
-	stmgeia	r0!, {r3, r12, lr}
-	subges	r2, r2, #0x0c
+	ldmiage	r1!, {r3, r12, lr}
+	stmiage	r0!, {r3, r12, lr}
+	subsge	r2, r2, #0x0c
 	bge	

CVS commit: src/sys/lib/libkern/arch/arm

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 04:58:01 UTC 2013

Modified Files:
src/sys/lib/libkern/arch/arm: clzsi2.S

Log Message:
Support thumb


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/lib/libkern/arch/arm/clzsi2.S

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

Modified files:

Index: src/sys/lib/libkern/arch/arm/clzsi2.S
diff -u src/sys/lib/libkern/arch/arm/clzsi2.S:1.4 src/sys/lib/libkern/arch/arm/clzsi2.S:1.5
--- src/sys/lib/libkern/arch/arm/clzsi2.S:1.4	Sat Sep  1 11:24:36 2012
+++ src/sys/lib/libkern/arch/arm/clzsi2.S	Sun Aug 11 04:58:01 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: clzsi2.S,v 1.4 2012/09/01 11:24:36 matt Exp $ */
+/* $NetBSD: clzsi2.S,v 1.5 2013/08/11 04:58:01 matt Exp $ */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -39,11 +39,21 @@ ENTRY(__clzdi2)
 #define	LO	r0
 #endif
 #if defined(_ARM_ARCH_5)
+#ifdef __thumb__
+	cmp	HI, #0
+	beq	1f
+	clz	r0, HI		/* count leading zeros in high word */
+	RET
+1:	clz	r0, LO		/* yes, count in low word */
+	add	r0, r0, #32	/*  and add the bits in the high word */
+	RET
+#else
 	teq	HI, #0		/* high word all zero? */
 	clzne	r0, HI		/* count leading zeros in high word */
 	clzeq	r0, LO		/* yes, count in low word */
 	addeq	r0, r0, #32	/*  and add the bits in the high word */
 	RET
+#endif
 #else
 	movs	r3, HI
 	movne	r0, #31



CVS commit: src/common/lib/libc/arch/arm/string

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Aug 11 05:02:36 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/string: ffs.S strcpy_naive.S
strlcat_naive.S

Log Message:
Convert some more conditional instructions to unified syntax


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/string/ffs.S \
src/common/lib/libc/arch/arm/string/strcpy_naive.S
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/arch/arm/string/strlcat_naive.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/string/ffs.S
diff -u src/common/lib/libc/arch/arm/string/ffs.S:1.2 src/common/lib/libc/arch/arm/string/ffs.S:1.3
--- src/common/lib/libc/arch/arm/string/ffs.S:1.2	Sun Jul  3 07:13:31 2011
+++ src/common/lib/libc/arch/arm/string/ffs.S	Sun Aug 11 05:02:35 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs.S,v 1.2 2011/07/03 07:13:31 matt Exp $	*/
+/*	$NetBSD: ffs.S,v 1.3 2013/08/11 05:02:35 matt Exp $	*/
 /*
  * Copyright (c) 2001 Christopher Gilbert
  * All rights reserved.
@@ -30,7 +30,7 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: ffs.S,v 1.2 2011/07/03 07:13:31 matt Exp $)
+RCSID($NetBSD: ffs.S,v 1.3 2013/08/11 05:02:35 matt Exp $)
 
 /*
  * ffs - find first set bit, this algorithm isolates the first set
@@ -67,7 +67,7 @@ ENTRY(ffs)
 	rsbne   r0, r0, r0, lsl #16 /* r0 = X * 0x0450fbaf */
   
 	/* now lookup in table indexed on top 6 bits of r0 */
-	ldrneb  r0, [ r2, r0, lsr #26 ]
+	ldrbne  r0, [ r2, r0, lsr #26 ]
 
 RET
 .text;
Index: src/common/lib/libc/arch/arm/string/strcpy_naive.S
diff -u src/common/lib/libc/arch/arm/string/strcpy_naive.S:1.2 src/common/lib/libc/arch/arm/string/strcpy_naive.S:1.3
--- src/common/lib/libc/arch/arm/string/strcpy_naive.S:1.2	Thu Jan 10 02:08:22 2013
+++ src/common/lib/libc/arch/arm/string/strcpy_naive.S	Sun Aug 11 05:02:35 2013
@@ -28,7 +28,7 @@
  */
 #include machine/asm.h
 
-RCSID($NetBSD: strcpy_naive.S,v 1.2 2013/01/10 02:08:22 matt Exp $)
+RCSID($NetBSD: strcpy_naive.S,v 1.3 2013/08/11 05:02:35 matt Exp $)
 
 #ifdef _LIBC
 #ifdef STRLCPY
@@ -76,7 +76,7 @@ ENTRY(strncpy)
 	teq	r3, #0			/* was it a NUL? */
 	bne	1b			/*   no, try next byte */
 2:	cmp	ip, r2			/* are at the end of dst already? */
-	strltb	r3, [ip], #1		/*   no, write a NUL */
+	strblt	r3, [ip], #1		/*   no, write a NUL */
 	blt	2b			/*   until dst is filled */
 3:	RET/* return dst pointer */
 END(strncpy)

Index: src/common/lib/libc/arch/arm/string/strlcat_naive.S
diff -u src/common/lib/libc/arch/arm/string/strlcat_naive.S:1.1 src/common/lib/libc/arch/arm/string/strlcat_naive.S:1.2
--- src/common/lib/libc/arch/arm/string/strlcat_naive.S:1.1	Fri Jan 18 22:49:11 2013
+++ src/common/lib/libc/arch/arm/string/strlcat_naive.S	Sun Aug 11 05:02:35 2013
@@ -29,7 +29,7 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: strlcat_naive.S,v 1.1 2013/01/18 22:49:11 matt Exp $)
+RCSID($NetBSD: strlcat_naive.S,v 1.2 2013/08/11 05:02:35 matt Exp $)
 
 /* LINTSTUB: size_t strlcat(char *, const char *, size_t) */
 ENTRY(strlcat)
@@ -51,7 +51,7 @@ ENTRY(strlcat)
 	beq	3f			/*   yes, end of append */
 	add	r0, r0, #1		/* count another byte */
 	cmp	ip, r3			/* do we have enough room for it? */
-	strltb	r2, [ip], #1		/*   yes, store it */
+	strblt	r2, [ip], #1		/*   yes, store it */
 	b	2b			/* get next byte from append */
 
 3:	mov	r2, #0			/* NUL */



CVS commit: src/libexec/getty

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 05:42:41 UTC 2013

Modified Files:
src/libexec/getty: Makefile extern.h gettytab.h init.c main.c subr.c

Log Message:
Pass WARNS=5.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/libexec/getty/Makefile
cvs rdiff -u -r1.6 -r1.7 src/libexec/getty/extern.h
cvs rdiff -u -r1.16 -r1.17 src/libexec/getty/gettytab.h
cvs rdiff -u -r1.17 -r1.18 src/libexec/getty/init.c
cvs rdiff -u -r1.60 -r1.61 src/libexec/getty/main.c
cvs rdiff -u -r1.33 -r1.34 src/libexec/getty/subr.c

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

Modified files:

Index: src/libexec/getty/Makefile
diff -u src/libexec/getty/Makefile:1.19 src/libexec/getty/Makefile:1.20
--- src/libexec/getty/Makefile:1.19	Wed Feb  3 15:34:43 2010
+++ src/libexec/getty/Makefile	Sun Aug 11 05:42:41 2013
@@ -1,8 +1,6 @@
-#	$NetBSD: Makefile,v 1.19 2010/02/03 15:34:43 roy Exp $
+#	$NetBSD: Makefile,v 1.20 2013/08/11 05:42:41 dholland Exp $
 #	from: @(#)Makefile	8.1 (Berkeley) 6/4/93
 
-WARNS?=	2	# XXX: many const  sign-compare issues
-
 PROG=	getty
 SRCS=	main.c init.c subr.c
 DPADD+=	${LIBUTIL} ${LIBTERMINFO}

Index: src/libexec/getty/extern.h
diff -u src/libexec/getty/extern.h:1.6 src/libexec/getty/extern.h:1.7
--- src/libexec/getty/extern.h:1.6	Thu Aug  7 09:46:41 2003
+++ src/libexec/getty/extern.h	Sun Aug 11 05:42:41 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.6 2003/08/07 09:46:41 agc Exp $	*/
+/*	$NetBSD: extern.h,v 1.7 2013/08/11 05:42:41 dholland Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -34,17 +34,17 @@
 struct delayval;
 
 int	 adelay(int, struct delayval *);
-char	*autobaud(void);
+const char *autobaud(void);
 int	 delaybits(void);
-void	 edithost(char *);
+void	 edithost(const char *);
 void	 gendefaults(void);
 int	 getent(char *, char *);
 int	 getflag(char *);
 long	 getnum(char *);
 char	*getstr(char *, char **);
-void	 gettable(char *, char *);
+void	 gettable(const char *, char *);
 void	 makeenv(char *[]);
-char	*portselector(void);
+const char *portselector(void);
 void	 set_ttydefaults(int);
 void	 setchars(void);
 void	 setdefaults(void);

Index: src/libexec/getty/gettytab.h
diff -u src/libexec/getty/gettytab.h:1.16 src/libexec/getty/gettytab.h:1.17
--- src/libexec/getty/gettytab.h:1.16	Thu Nov 16 04:31:24 2006
+++ src/libexec/getty/gettytab.h	Sun Aug 11 05:42:41 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: gettytab.h,v 1.16 2006/11/16 04:31:24 christos Exp $	*/
+/*	$NetBSD: gettytab.h,v 1.17 2013/08/11 05:42:41 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993, 1994
@@ -35,20 +35,20 @@
  * Getty description definitions.
  */
 struct	gettystrs {
-	char	*field;		/* name to lookup in gettytab */
-	char	*defalt;	/* value we find by looking in defaults */
+	const char *field;	/* name to lookup in gettytab */
+	const char *defalt;	/* value we find by looking in defaults */
 	char	*value;		/* value that we find there */
 };
 
 struct	gettynums {
-	char	*field;		/* name to lookup */
+	const char *field;	/* name to lookup */
 	long	defalt;		/* number we find in defaults */
 	long	value;		/* number we find there */
 	int	set;		/* we actually got this one */
 };
 
 struct gettyflags {
-	char	*field;		/* name to lookup */
+	const char *field;	/* name to lookup */
 	char	invrt;		/* name existing in gettytab -- false */
 	char	defalt;		/* true/false in defaults */
 	char	value;		/* true/false flag */

Index: src/libexec/getty/init.c
diff -u src/libexec/getty/init.c:1.17 src/libexec/getty/init.c:1.18
--- src/libexec/getty/init.c:1.17	Mon Dec  3 09:54:24 2007
+++ src/libexec/getty/init.c	Sun Aug 11 05:42:41 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: init.c,v 1.17 2007/12/03 09:54:24 isaki Exp $	*/
+/*	$NetBSD: init.c,v 1.18 2013/08/11 05:42:41 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = from: @(#)init.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: init.c,v 1.17 2007/12/03 09:54:24 isaki Exp $);
+__RCSID($NetBSD: init.c,v 1.18 2013/08/11 05:42:41 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -44,6 +44,7 @@ __RCSID($NetBSD: init.c,v 1.17 2007/12/
  * Melbourne getty.
  */
 
+#include stddef.h
 #include termios.h
 
 #include gettytab.h
@@ -55,92 +56,92 @@ extern	char hostname[];
 #define M(a) ((char *)tmode.c_cc[a])
 
 struct	gettystrs gettystrs[] = {
-	{ nx },		/* next table */
-	{ cl },		/* screen clear characters */
-	{ im },		/* initial message */
-	{ lm, login:  },	/* login message */
-	{ er, M(VERASE) },	/* erase character */
-	{ kl, M(VKILL) },	/* kill character */
-	{ et, M(VEOF) },	/* eof chatacter (eot) */
-	{ pc,  },		/* pad character */
-	{ tt },		/* terminal type */
-	{ ev },		/* environment */
-	{ lo, _PATH_LOGIN },	/* login program */
-	{ hn, hostname },	/* host name */
-	{ he },		/* host name edit */
-	{ in, M(VINTR) },	/* interrupt char */
-	{ qu, M(VQUIT) },	/* quit char */
-	{ xn, M(VSTART) },	/* XON (start) char */
-	{ xf, 

CVS commit: src/libexec/getty

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 05:48:56 UTC 2013

Modified Files:
src/libexec/getty: main.c

Log Message:
Use siglongjmp to jump out of signal handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/libexec/getty/main.c

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

Modified files:

Index: src/libexec/getty/main.c
diff -u src/libexec/getty/main.c:1.61 src/libexec/getty/main.c:1.62
--- src/libexec/getty/main.c:1.61	Sun Aug 11 05:42:41 2013
+++ src/libexec/getty/main.c	Sun Aug 11 05:48:56 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.61 2013/08/11 05:42:41 dholland Exp $	*/
+/*	$NetBSD: main.c,v 1.62 2013/08/11 05:48:56 dholland Exp $	*/
 
 /*-
  * Copyright (c) 1980, 1993
@@ -40,7 +40,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = from: @(#)main.c	8.1 (Berkeley) 6/20/93;
 #else
-__RCSID($NetBSD: main.c,v 1.61 2013/08/11 05:42:41 dholland Exp $);
+__RCSID($NetBSD: main.c,v 1.62 2013/08/11 05:48:56 dholland Exp $);
 #endif
 #endif /* not lint */
 
@@ -135,7 +135,7 @@ const unsigned char partab[] = {
 
 static void	clearscreen(void);
 
-jmp_buf timeout;
+sigjmp_buf timeout;
 
 static void
 /*ARGSUSED*/
@@ -144,10 +144,10 @@ dingdong(int signo)
 
 	(void)alarm(0);
 	(void)signal(SIGALRM, SIG_DFL);
-	longjmp(timeout, 1);
+	siglongjmp(timeout, 1);
 }
 
-jmp_buf	intrupt;
+sigjmp_buf intrupt;
 
 static void
 /*ARGSUSED*/
@@ -155,7 +155,7 @@ interrupt(int signo)
 {
 
 	(void)signal(SIGINT, interrupt);
-	longjmp(intrupt, 1);
+	siglongjmp(intrupt, 1);
 }
 
 /*
@@ -357,7 +357,7 @@ main(int argc, char *argv[], char *envp[
 		if (IM  *IM)
 			putf(IM);
 		oflush();
-		if (setjmp(timeout)) {
+		if (sigsetjmp(timeout, 1)) {
 			tmode.c_ispeed = tmode.c_ospeed = 0;
 			(void)tcsetattr(0, TCSANOW, tmode);
 			exit(1);
@@ -455,7 +455,7 @@ getname(void)
 	/*
 	 * Interrupt may happen if we use CBREAK mode
 	 */
-	if (setjmp(intrupt)) {
+	if (sigsetjmp(intrupt, 1)) {
 		(void)signal(SIGINT, SIG_IGN);
 		return (0);
 	}



CVS commit: src/sbin

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 05:56:55 UTC 2013

Modified Files:
src/sbin/modload: Makefile
src/sbin/modstat: Makefile
src/sbin/modunload: Makefile

Log Message:
WARNS=5 is the default in sbin, don't need to set it explicitly.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sbin/modload/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sbin/modstat/Makefile
cvs rdiff -u -r1.15 -r1.16 src/sbin/modunload/Makefile

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

Modified files:

Index: src/sbin/modload/Makefile
diff -u src/sbin/modload/Makefile:1.16 src/sbin/modload/Makefile:1.17
--- src/sbin/modload/Makefile:1.16	Wed Aug 22 07:47:18 2012
+++ src/sbin/modload/Makefile	Sun Aug 11 05:56:55 2013
@@ -1,9 +1,7 @@
-#	$NetBSD: Makefile,v 1.16 2012/08/22 07:47:18 jnemeth Exp $
+#	$NetBSD: Makefile,v 1.17 2013/08/11 05:56:55 dholland Exp $
 
 .include bsd.own.mk
 
-WARNS=	5
-
 RUMPPRG=modload
 SRCS=	main.c
 MAN=	modload.8

Index: src/sbin/modstat/Makefile
diff -u src/sbin/modstat/Makefile:1.3 src/sbin/modstat/Makefile:1.4
--- src/sbin/modstat/Makefile:1.3	Thu Aug 16 19:47:48 2012
+++ src/sbin/modstat/Makefile	Sun Aug 11 05:56:55 2013
@@ -1,9 +1,7 @@
-#	$NetBSD: Makefile,v 1.3 2012/08/16 19:47:48 jnemeth Exp $
+#	$NetBSD: Makefile,v 1.4 2013/08/11 05:56:55 dholland Exp $
 
 RUMPPRG=modstat
 SRCS=	main.c
 MAN=	modstat.8
 
-WARNS=	5
-
 .include bsd.prog.mk

Index: src/sbin/modunload/Makefile
diff -u src/sbin/modunload/Makefile:1.15 src/sbin/modunload/Makefile:1.16
--- src/sbin/modunload/Makefile:1.15	Wed Aug 22 07:47:19 2012
+++ src/sbin/modunload/Makefile	Sun Aug 11 05:56:55 2013
@@ -1,6 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2012/08/22 07:47:19 jnemeth Exp $
-
-WARNS=	5
+#	$NetBSD: Makefile,v 1.16 2013/08/11 05:56:55 dholland Exp $
 
 RUMPPRG=modunload
 SRCS=	main.c



CVS commit: src/sys/dev/pci

2013-08-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Aug 10 18:01:31 UTC 2013

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

Log Message:
Make sure to check if the driver has a valid intr handler in virtio_detach().

Fixes a panic during shutdown on KVM under ubuntu 13.04 with virtio,
as reported in PR kern/48105 by Richard Hansen.

Should be pulled up to netbsd-6 branches.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/virtio.c

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



CVS commit: src/sys/dev/pci/bktr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 18:14:21 UTC 2013

Modified Files:
src/sys/dev/pci/bktr: bktr_os.c

Log Message:
Redo -r1.53 correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pci/bktr/bktr_os.c

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



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:28:15 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_inc_64.S

Log Message:
Fix add - adds


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S

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



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:32:06 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_inc_64.S

Log Message:
Don't adjust return of atomic_inc_64 since it's void and doesn't return
anything.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S

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



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:38:33 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_swap_64.S

Log Message:
cmpne - cmp
Use push/pop


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S

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



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:39:48 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_add_64.S

Log Message:
use push/pop


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S

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



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:39:07 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_or_64.S

Log Message:
use push/pop


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_or_64.S

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



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:39:25 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_and_64.S

Log Message:
Use push/pop


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S

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



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:40:19 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_dec_64.S

Log Message:
Use subs/sbc
Use push/pop
Don't adjust return for atomic_dec_64 since it's void and returns nothing


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S

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



CVS commit: src/lib/libcrypt

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 18:42:29 UTC 2013

Modified Files:
src/lib/libcrypt: Makefile crypt-sha1.c

Log Message:
Silence -Wpointer-sign on crypt-sha1.c.
This requires casts, which is not entirely desirable; however, this way
at least no *more* pointer sign issues can creep in.

Output object files are unchanged on amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libcrypt/Makefile
cvs rdiff -u -r1.6 -r1.7 src/lib/libcrypt/crypt-sha1.c

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



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 18:45:12 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_dec_64.S atomic_inc_64.S

Log Message:
Use r2 instead of ip


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S

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



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 19:02:22 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_add_64.S atomic_and_64.S
atomic_or_64.S

Log Message:
Never modify NLO/NHI (r2,r3) only LO/HI (r0,r1) so subsequent loops will work.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_or_64.S

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



CVS commit: src/common/lib/libc/arch/arm/atomic

2013-08-10 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 10 19:59:21 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/atomic: atomic_add_32.S atomic_add_64.S
atomic_and_32.S atomic_and_64.S atomic_cas_32.S atomic_cas_64.S
atomic_cas_8.S atomic_cas_up.S atomic_dec_32.S atomic_dec_64.S
atomic_inc_32.S atomic_inc_64.S atomic_or_32.S atomic_or_64.S
atomic_swap.S atomic_swap_64.S

Log Message:
Make these under Thumb2


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/arm/atomic/atomic_add_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_and_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_dec_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_or_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_swap_64.S
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/arch/arm/atomic/atomic_add_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_swap.S
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/arm/atomic/atomic_and_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_cas_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_cas_8.S \
src/common/lib/libc/arch/arm/atomic/atomic_dec_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_inc_32.S \
src/common/lib/libc/arch/arm/atomic/atomic_or_64.S
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/atomic/atomic_cas_64.S \
src/common/lib/libc/arch/arm/atomic/atomic_cas_up.S
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/arm/atomic/atomic_inc_64.S

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 20:59:27 UTC 2013

Modified Files:
src/usr.bin/tr: tr.1

Log Message:
punctuation usage


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/tr/tr.1

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



CVS commit: src/sys/dev/usb

2013-08-10 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sat Aug 10 21:15:26 UTC 2013

Modified Files:
src/sys/dev/usb: if_urtwn.c usbdevs usbdevs.h usbdevs_data.h

Log Message:
PR/48112 - Kai-Uwe Eckhardt -- add support for Sitecom N300 usb wifi adapter


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.651 -r1.652 src/sys/dev/usb/usbdevs
cvs rdiff -u -r1.643 -r1.644 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.644 -r1.645 src/sys/dev/usb/usbdevs_data.h

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

2013-08-10 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Aug 10 21:20:03 UTC 2013

Modified Files:
src/usr.bin/make: parse.c

Log Message:
ParseGetLine: don't treat a zero byte as end of buffer if P_end says it isn't.
Consume up to next newline, and issue a parse warning.
If no newline found before P_end, carry on as before.


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/make/parse.c

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



CVS commit: src/share/man/man4

2013-08-10 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sat Aug 10 21:32:07 UTC 2013

Modified Files:
src/share/man/man4: urtwn.4

Log Message:
PR/48112 - Kai-Uwe Eckhardt -- add support for Sitecom N300 USB WIFI adapter


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/urtwn.4

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



CVS commit: src/tests/usr.bin

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 22:36:16 UTC 2013

Modified Files:
src/tests/usr.bin: Makefile
Added Files:
src/tests/usr.bin/tr: Makefile t_basic.sh

Log Message:
Add tests for tr, including an xfail one for PR 48113.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/usr.bin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/tr/Makefile \
src/tests/usr.bin/tr/t_basic.sh

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



CVS commit: src/share/misc

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 22:37:58 UTC 2013

Modified Files:
src/share/misc: acronyms

Log Message:
+tp


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/share/misc/acronyms

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



CVS commit: src/distrib/sets/lists/tests

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 22:37:06 UTC 2013

Modified Files:
src/distrib/sets/lists/tests: mi

Log Message:
+tp


To generate a diff of this commit:
cvs rdiff -u -r1.542 -r1.543 src/distrib/sets/lists/tests/mi

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



CVS commit: [netbsd-6] src/sys/arch/i386/stand

2013-08-10 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Aug 10 22:42:29 UTC 2013

Modified Files:
src/sys/arch/i386/stand/boot [netbsd-6]: boot2.c
src/sys/arch/i386/stand/lib [netbsd-6]: bootmenu.c bootmenu.h

Log Message:
Pull up following revision(s) (requested by he in ticket #925):
sys/arch/i386/stand/lib/bootmenu.c: revision 1.11
sys/arch/i386/stand/lib/bootmenu.h: revision 1.3
sys/arch/i386/stand/boot/boot2.c: revision 1.59
Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:
 * Add a menu command which re-displays the menu and initiates
   the timed countdown
 * Use any default command defined in boot.cfg as default args
   if the user runs boot with no arguments
This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply boot netbsd is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).


To generate a diff of this commit:
cvs rdiff -u -r1.57.2.1 -r1.57.2.2 src/sys/arch/i386/stand/boot/boot2.c
cvs rdiff -u -r1.10 -r1.10.8.1 src/sys/arch/i386/stand/lib/bootmenu.c
cvs rdiff -u -r1.2 -r1.2.26.1 src/sys/arch/i386/stand/lib/bootmenu.h

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



CVS commit: [netbsd-6] src/sys/dev/i2c

2013-08-10 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Aug 10 22:50:56 UTC 2013

Modified Files:
src/sys/dev/i2c [netbsd-6]: files.i2c
Added Files:
src/sys/dev/i2c [netbsd-6]: w83795g.c w83795greg.h

Log Message:
Pull up following revision(s) (requested by matt in ticket #929):
sys/dev/i2c/w83795g.c: revision 1.1
sys/dev/i2c/w83795greg.h: revision 1.1
sys/dev/i2c/files.i2c: revision 1.50
Add driver for Nuvoton W83795G voltage/temp/fan/gpio monitoring device.
As used in the HP Microserver N36L/N40L/N54L:
w83795g* at iic? addr 0x2f
gpio* at gpiobus?
Note that the gpio and watchdog functionality appears to be useless on
the Microserver, as the gpio pins don't affect the LED's and a watchdog
trigger does not cause a reset. Perhaps the reset pin just isn't wired.
There are quite flexible fan control options as well as just monitoring,
but it is not clear to me how best to export that function to userspace.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.6.1 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1.2.2 src/sys/dev/i2c/w83795g.c \
src/sys/dev/i2c/w83795greg.h

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



CVS commit: [netbsd-6] src/doc

2013-08-10 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat Aug 10 22:52:34 UTC 2013

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Tickets 925, 929.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.30 -r1.1.2.31 src/doc/CHANGES-6.2

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



CVS commit: src/sbin/newfs_udf

2013-08-10 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Sat Aug 10 23:25:35 UTC 2013

Modified Files:
src/sbin/newfs_udf: udf_create.c

Log Message:
Fix tool build under Mac OS X by using gettimeofday(2) instead of
clock_gettime(2). This needs a proper auto-config check.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sbin/newfs_udf/udf_create.c

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug 10 23:54:41 UTC 2013

Modified Files:
src/usr.bin/tr: extern.h str.c tr.c

Log Message:
Expose less of the parser state outside str.c.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/tr/extern.h
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/tr/str.c
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/tr/tr.c

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:04:14 UTC 2013

Modified Files:
src/usr.bin/tr: extern.h str.c tr.c

Log Message:
Make the parser state opaque. While here, fix a memory leak when using
the [:foo:] syntax.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/tr/extern.h
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/tr/str.c
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/tr/tr.c

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:05:49 UTC 2013

Modified Files:
src/usr.bin/tr: extern.h str.c tr.c

Log Message:
sprinkle const


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/tr/extern.h
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/tr/str.c
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/tr/tr.c

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:11:46 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
Restore preexisting wrong behavior of tr -c (translates all characters
to the last letter in string2) instead of a different wrong behavior
(translates all characters to 0xff) accidentally just introduced.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/tr/tr.c

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:12:47 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
apply some CSE


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/tr/tr.c

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:28:46 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
Make tr -c work. Fixes PR 48113.

When -c is in effect, scan string1 first, complement it, and then
iterate over the results while scanning string2. Otherwise, scan
string1 and string2 together as before.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/tr/tr.c

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



CVS commit: src/tests/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:29:22 UTC 2013

Modified Files:
src/tests/usr.bin/tr: t_basic.sh

Log Message:
Remove xfail for PR 48113.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/tr/t_basic.sh

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:34:09 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
Remove silly written-out initialization of string1.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/tr/tr.c

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:39:22 UTC 2013

Modified Files:
src/usr.bin/tr: extern.h str.c tr.c

Log Message:
Simplify the parser handling.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/tr/extern.h
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/tr/str.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/tr/tr.c

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:48:37 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
Add comments explaining how this works.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/tr/tr.c

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



CVS commit: src/usr.bin/tr

2013-08-10 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 11 00:49:15 UTC 2013

Modified Files:
src/usr.bin/tr: tr.c

Log Message:
Don't explicitly zero bss variables that are already zeroed.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/tr/tr.c

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



  1   2   >