[Midnightbsd-cvs] src [11321] trunk/usr.bin/tr/tr.c: sync tr with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Jul 4 16:59:54 EDT 2018


Revision: 11321
          http://svnweb.midnightbsd.org/src/?rev=11321
Author:   laffer1
Date:     2018-07-04 16:59:54 -0400 (Wed, 04 Jul 2018)
Log Message:
-----------
sync tr with freebsd

Modified Paths:
--------------
    trunk/usr.bin/tr/Makefile
    trunk/usr.bin/tr/cmap.c
    trunk/usr.bin/tr/cmap.h
    trunk/usr.bin/tr/cset.c
    trunk/usr.bin/tr/cset.h
    trunk/usr.bin/tr/extern.h
    trunk/usr.bin/tr/str.c
    trunk/usr.bin/tr/tr.1
    trunk/usr.bin/tr/tr.c

Added Paths:
-----------
    trunk/usr.bin/tr/tests/
    trunk/usr.bin/tr/tests/Makefile
    trunk/usr.bin/tr/tests/legacy_test.sh
    trunk/usr.bin/tr/tests/regress.00.out
    trunk/usr.bin/tr/tests/regress.01.out
    trunk/usr.bin/tr/tests/regress.02.out
    trunk/usr.bin/tr/tests/regress.03.out
    trunk/usr.bin/tr/tests/regress.04.out
    trunk/usr.bin/tr/tests/regress.05.out
    trunk/usr.bin/tr/tests/regress.06.out
    trunk/usr.bin/tr/tests/regress.07.out
    trunk/usr.bin/tr/tests/regress.08.out
    trunk/usr.bin/tr/tests/regress.09.out
    trunk/usr.bin/tr/tests/regress.0a.out
    trunk/usr.bin/tr/tests/regress.0b.out
    trunk/usr.bin/tr/tests/regress.0c.out
    trunk/usr.bin/tr/tests/regress.0d.out
    trunk/usr.bin/tr/tests/regress.in
    trunk/usr.bin/tr/tests/regress.sh
    trunk/usr.bin/tr/tests/regress2.in

Property Changed:
----------------
    trunk/usr.bin/tr/tr.1

Modified: trunk/usr.bin/tr/Makefile
===================================================================
--- trunk/usr.bin/tr/Makefile	2018-07-04 20:56:47 UTC (rev 11320)
+++ trunk/usr.bin/tr/Makefile	2018-07-04 20:59:54 UTC (rev 11321)
@@ -1,9 +1,14 @@
+# $MidnightBSD$
 #	@(#)Makefile	8.1 (Berkeley) 6/6/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/tr/Makefile 264996 2014-04-27 01:15:10Z jmmv $
 
+.include <bsd.own.mk>
+
 PROG=	tr
 SRCS=	cmap.c cset.c str.c tr.c
 
-WARNS?=	1
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
 
 .include <bsd.prog.mk>

Modified: trunk/usr.bin/tr/cmap.c
===================================================================
--- trunk/usr.bin/tr/cmap.c	2018-07-04 20:56:47 UTC (rev 11320)
+++ trunk/usr.bin/tr/cmap.c	2018-07-04 20:59:54 UTC (rev 11321)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/tr/cmap.c 200462 2009-12-13 03:14:06Z delphij $");
 
 #include <assert.h>
 #include <limits.h>

Modified: trunk/usr.bin/tr/cmap.h
===================================================================
--- trunk/usr.bin/tr/cmap.h	2018-07-04 20:56:47 UTC (rev 11320)
+++ trunk/usr.bin/tr/cmap.h	2018-07-04 20:59:54 UTC (rev 11321)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2004 Tim J. Robbins.
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.bin/tr/cmap.h 200462 2009-12-13 03:14:06Z delphij $
  */
 
 #ifndef CMAP_H

Modified: trunk/usr.bin/tr/cset.c
===================================================================
--- trunk/usr.bin/tr/cset.c	2018-07-04 20:56:47 UTC (rev 11320)
+++ trunk/usr.bin/tr/cset.c	2018-07-04 20:59:54 UTC (rev 11321)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2004 Tim J. Robbins.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/tr/cset.c 226363 2011-10-14 10:43:55Z ed $");
 
 #include <assert.h>
 #include <stdbool.h>
@@ -153,11 +154,11 @@
 	struct csclass *csc;
 
 	for (csc = cs->cs_classes; csc != NULL; csc = csc->csc_next)
-		if (csc->csc_invert ^ iswctype(ch, csc->csc_type) != 0)
+		if (csc->csc_invert ^ (iswctype(ch, csc->csc_type) != 0))
 			return (cs->cs_invert ^ true);
 	if (cs->cs_root != NULL) {
 		cs->cs_root = cset_splay(cs->cs_root, ch);
-		return (cs->cs_invert ^ cset_rangecmp(cs->cs_root, ch) == 0);
+		return (cs->cs_invert ^ (cset_rangecmp(cs->cs_root, ch) == 0));
 	}
 	return (cs->cs_invert ^ false);
 }

Modified: trunk/usr.bin/tr/cset.h
===================================================================
--- trunk/usr.bin/tr/cset.h	2018-07-04 20:56:47 UTC (rev 11320)
+++ trunk/usr.bin/tr/cset.h	2018-07-04 20:59:54 UTC (rev 11321)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2004 Tim J. Robbins.
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.bin/tr/cset.h 200462 2009-12-13 03:14:06Z delphij $
  */
 
 #ifndef CSET_H

Modified: trunk/usr.bin/tr/extern.h
===================================================================
--- trunk/usr.bin/tr/extern.h	2018-07-04 20:56:47 UTC (rev 11320)
+++ trunk/usr.bin/tr/extern.h	2018-07-04 20:59:54 UTC (rev 11321)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -27,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)extern.h	8.1 (Berkeley) 6/6/93
- * $MidnightBSD$
+ * $FreeBSD: stable/10/usr.bin/tr/extern.h 216370 2010-12-11 08:32:16Z joel $
  */
 
 #include <limits.h>

Modified: trunk/usr.bin/tr/str.c
===================================================================
--- trunk/usr.bin/tr/str.c	2018-07-04 20:56:47 UTC (rev 11320)
+++ trunk/usr.bin/tr/str.c	2018-07-04 20:59:54 UTC (rev 11321)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -29,7 +30,7 @@
 
 #include <sys/cdefs.h>
 
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/tr/str.c 229403 2012-01-03 18:51:58Z ed $");
 
 #ifndef lint
 static const char sccsid[] = "@(#)str.c	8.2 (Berkeley) 4/28/95";
@@ -57,8 +58,7 @@
 static void	genseq(STR *);
 
 wint_t
-next(s)
-	STR *s;
+next(STR *s)
 {
 	int is_octal;
 	wint_t ch;
@@ -135,8 +135,7 @@
 }
 
 static int
-bracket(s)
-	STR *s;
+bracket(STR *s)
 {
 	char *p;
 
@@ -163,7 +162,7 @@
 	repeat:
 		if ((p = strpbrk(s->str + 2, "*]")) == NULL)
 			return (0);
-		if (p[0] != '*' || index(p, ']') == NULL)
+		if (p[0] != '*' || strchr(p, ']') == NULL)
 			return (0);
 		s->str += 1;
 		genseq(s);
@@ -173,8 +172,7 @@
 }
 
 static void
-genclass(s)
-	STR *s;
+genclass(STR *s)
 {
 
 	if ((s->cclass = wctype(s->str)) == 0)
@@ -190,8 +188,7 @@
 }
 
 static void
-genequiv(s)
-	STR *s;
+genequiv(STR *s)
 {
 	int i, p, pri;
 	char src[2], dst[3];
@@ -295,8 +292,7 @@
 }
 
 static void
-genseq(s)
-	STR *s;
+genseq(STR *s)
 {
 	char *ep;
 	wchar_t wc;

Added: trunk/usr.bin/tr/tests/Makefile
===================================================================
--- trunk/usr.bin/tr/tests/Makefile	                        (rev 0)
+++ trunk/usr.bin/tr/tests/Makefile	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,27 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/tr/tests/Makefile 263227 2014-03-16 08:04:06Z jmmv $
+
+TESTSDIR=	${TESTSBASE}/usr.bin/tr
+
+TAP_TESTS_SH=	legacy_test
+
+FILESDIR=	${TESTSDIR}
+FILES=		regress.00.out
+FILES+=		regress.01.out
+FILES+=		regress.02.out
+FILES+=		regress.03.out
+FILES+=		regress.04.out
+FILES+=		regress.05.out
+FILES+=		regress.06.out
+FILES+=		regress.07.out
+FILES+=		regress.08.out
+FILES+=		regress.09.out
+FILES+=		regress.0a.out
+FILES+=		regress.0b.out
+FILES+=		regress.0c.out
+FILES+=		regress.0d.out
+FILES+=		regress.in
+FILES+=		regress.sh
+FILES+=		regress2.in
+
+.include <bsd.test.mk>


Property changes on: trunk/usr.bin/tr/tests/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/legacy_test.sh
===================================================================
--- trunk/usr.bin/tr/tests/legacy_test.sh	                        (rev 0)
+++ trunk/usr.bin/tr/tests/legacy_test.sh	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $MidnightBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh


Property changes on: trunk/usr.bin/tr/tests/legacy_test.sh
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.00.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.00.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.00.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,4 @@
+qui3k 2rown
+fox jump54
+ov5r th5 l1zy
+4og


Property changes on: trunk/usr.bin/tr/tests/regress.00.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.01.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.01.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.01.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog


Property changes on: trunk/usr.bin/tr/tests/regress.01.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.02.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.02.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.02.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,4 @@
+quik brown
+fox jumpd
+ovr th lzy
+do


Property changes on: trunk/usr.bin/tr/tests/regress.02.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.03.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.03.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.03.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,4 @@
+QUICK BROWN
+FOX JUMPED
+OVER THE LAZY
+DOG


Property changes on: trunk/usr.bin/tr/tests/regress.03.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.04.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.04.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.04.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,4 @@
+..... .....
+... ......
+.... ... ....
+...


Property changes on: trunk/usr.bin/tr/tests/regress.04.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.05.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.05.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.05.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog


Property changes on: trunk/usr.bin/tr/tests/regress.05.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.06.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.06.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.06.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,9 @@
+??? bottles of beer on the wall, ??? bottles of beer.
+Take one down and pass it around - ?? bottles of beer on the wall.
+?? bottles of beer on the wall, ?? bottles of beer.
+Take one down and pass it around - ?? bottles of beer on the wall.
+...
+? bottles of beer on the wall, ? bottles of beer!!!
+Take one down and pass it around - ? bottle of beer on the wall.
+? bottle of beer on the wall, ? bottle of beer!!!
+Take it down and pass it around - NO MORE bottles of beer on the wall!!!


Property changes on: trunk/usr.bin/tr/tests/regress.06.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.07.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.07.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.07.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,9 @@
+### ####### ## #### ## ### ####, ### ####### ## ####.
+#### ### #### ### #### ## ###### - ## ####### ## #### ## ### ####.
+## ####### ## #### ## ### ####, ## ####### ## ####.
+#### ### #### ### #### ## ###### - ## ####### ## #### ## ### ####.
+...
+# ####### ## #### ## ### ####, # ####### ## ####!!!
+#### ### #### ### #### ## ###### - # ###### ## #### ## ### ####.
+# ###### ## #### ## ### ####, # ###### ## ####!!!
+#### ## #### ### #### ## ###### - ## #### ####### ## #### ## ### ####!!!


Property changes on: trunk/usr.bin/tr/tests/regress.07.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.08.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.08.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.08.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,9 @@
+100,100.
+-99.
+99,99.
+-98.
+...
+2,2!!!
+-1.
+1,1!!!
+-!!!


Property changes on: trunk/usr.bin/tr/tests/regress.08.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.09.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.09.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.09.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1 @@
+?#


Property changes on: trunk/usr.bin/tr/tests/regress.09.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.0a.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.0a.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.0a.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1 @@
+$?$$$$$$$$


Property changes on: trunk/usr.bin/tr/tests/regress.0a.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.0b.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.0b.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.0b.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1 @@
+100befbeeea100befbeeaeedadaad99befbeeea99befbeeea99befbeeaeedadaad98befbeeea2befbeeea2befbeeaeedadaad1befbeeea1befbeeea1befbeeaedadaadEbefbeeea


Property changes on: trunk/usr.bin/tr/tests/regress.0b.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.0c.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.0c.out	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.0c.out	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1 @@
+[[[[


Property changes on: trunk/usr.bin/tr/tests/regress.0c.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.0d.out
===================================================================
(Binary files differ)

Index: trunk/usr.bin/tr/tests/regress.0d.out
===================================================================
--- trunk/usr.bin/tr/tests/regress.0d.out	2018-07-04 20:56:47 UTC (rev 11320)
+++ trunk/usr.bin/tr/tests/regress.0d.out	2018-07-04 20:59:54 UTC (rev 11321)

Property changes on: trunk/usr.bin/tr/tests/regress.0d.out
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.in
===================================================================
--- trunk/usr.bin/tr/tests/regress.in	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.in	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog


Property changes on: trunk/usr.bin/tr/tests/regress.in
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress.sh
===================================================================
--- trunk/usr.bin/tr/tests/regress.sh	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress.sh	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,22 @@
+# $MidnightBSD$
+
+echo 1..14
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`00', `tr abcde 12345 <${SRCDIR}/regress.in')
+REGRESSION_TEST(`01', `tr 12345 abcde <${SRCDIR}/regress.in')
+REGRESSION_TEST(`02', `tr -d aceg <${SRCDIR}/regress.in')
+REGRESSION_TEST(`03', `tr "[[:lower:]]" "[[:upper:]]" <${SRCDIR}/regress.in')
+REGRESSION_TEST(`04', `tr "[[:alpha:]]" . <${SRCDIR}/regress.in')
+REGRESSION_TEST(`05', `tr "[[:lower:]]" "[[:upper:]]" <${SRCDIR}/regress.in | tr "[[:upper:]]" "[[:lower:]]"')
+REGRESSION_TEST(`06', `tr "[[:digit:]]" "?" <${SRCDIR}/regress2.in')
+REGRESSION_TEST(`07', `tr "[[:alnum:]]" "#" <${SRCDIR}/regress2.in')
+REGRESSION_TEST(`08', `tr "[[:upper:]]" "[[:lower:]]" <${SRCDIR}/regress2.in | tr -d "[^[:alpha:]] "')
+REGRESSION_TEST(`09', `printf "\\f\\r\\n" | tr "\\014\\r" "?#"')
+REGRESSION_TEST(`0a', `printf "0xdeadbeef\\n" | tr "x[[:xdigit:]]" "?\$"')
+REGRESSION_TEST(`0b', `(tr -cd "[[:xdigit:]]" <${SRCDIR}/regress2.in ; echo)')
+REGRESSION_TEST(`0c', `echo "[[[[]]]]" | tr -d "[=]=]"')
+REGRESSION_TEST(`0d', `echo "]=[" | tr -d "[=]"')
+
+REGRESSION_END()


Property changes on: trunk/usr.bin/tr/tests/regress.sh
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/usr.bin/tr/tests/regress2.in
===================================================================
--- trunk/usr.bin/tr/tests/regress2.in	                        (rev 0)
+++ trunk/usr.bin/tr/tests/regress2.in	2018-07-04 20:59:54 UTC (rev 11321)
@@ -0,0 +1,9 @@
+100 bottles of beer on the wall, 100 bottles of beer.
+Take one down and pass it around - 99 bottles of beer on the wall.
+99 bottles of beer on the wall, 99 bottles of beer.
+Take one down and pass it around - 98 bottles of beer on the wall.
+...
+2 bottles of beer on the wall, 2 bottles of beer!!!
+Take one down and pass it around - 1 bottle of beer on the wall.
+1 bottle of beer on the wall, 1 bottle of beer!!!
+Take it down and pass it around - NO MORE bottles of beer on the wall!!!


Property changes on: trunk/usr.bin/tr/tests/regress2.in
___________________________________________________________________
Added: mnbsd:nokeywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/usr.bin/tr/tr.1
===================================================================
--- trunk/usr.bin/tr/tr.1	2018-07-04 20:56:47 UTC (rev 11320)
+++ trunk/usr.bin/tr/tr.1	2018-07-04 20:59:54 UTC (rev 11321)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -29,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)tr.1	8.1 (Berkeley) 6/6/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/tr/tr.1 303200 2016-07-22 19:34:43Z ache $
 .\"
 .Dd October 13, 2006
 .Dt TR 1
@@ -145,15 +146,14 @@
 .It \echaracter
 A backslash followed by certain special characters maps to special
 values.
-.Pp
 .Bl -column "\ea"
-.It "\ea	<alert character>
-.It "\eb	<backspace>
-.It "\ef	<form-feed>
-.It "\en	<newline>
-.It "\er	<carriage return>
-.It "\et	<tab>
-.It "\ev	<vertical tab>
+.It "\ea	<alert character>"
+.It "\eb	<backspace>"
+.It "\ef	<form-feed>"
+.It "\en	<newline>"
+.It "\er	<carriage return>"
+.It "\et	<tab>"
+.It "\ev	<vertical tab>"
 .El
 .Pp
 A backslash followed by any other character maps to that character.
@@ -177,24 +177,23 @@
 .It [:class:]
 Represents all characters belonging to the defined character class.
 Class names are:
-.Pp
 .Bl -column "phonogram"
-.It "alnum	<alphanumeric characters>
-.It "alpha	<alphabetic characters>
-.It "blank	<whitespace characters>
-.It "cntrl	<control characters>
-.It "digit	<numeric characters>
-.It "graph	<graphic characters>
-.It "ideogram	<ideographic characters>
-.It "lower	<lower-case alphabetic characters>
-.It "phonogram	<phonographic characters>
-.It "print	<printable characters>
-.It "punct	<punctuation characters>
-.It "rune	<valid characters>
-.It "space	<space characters>
-.It "special	<special characters>
-.It "upper	<upper-case characters>
-.It "xdigit	<hexadecimal characters>
+.It "alnum	<alphanumeric characters>"
+.It "alpha	<alphabetic characters>"
+.It "blank	<whitespace characters>"
+.It "cntrl	<control characters>"
+.It "digit	<numeric characters>"
+.It "graph	<graphic characters>"
+.It "ideogram	<ideographic characters>"
+.It "lower	<lower-case alphabetic characters>"
+.It "phonogram	<phonographic characters>"
+.It "print	<printable characters>"
+.It "punct	<punctuation characters>"
+.It "rune	<valid characters>"
+.It "space	<space characters>"
+.It "special	<special characters>"
+.It "upper	<upper-case characters>"
+.It "xdigit	<hexadecimal characters>"
 .El
 .Pp
 .\" All classes may be used in
@@ -336,6 +335,10 @@
 and
 .Dq Li A-Z .
 .Pp
+.Dq Li [=equiv=]
+expression and collation for ranges
+are implemented for single byte locales only.
+.Pp
 System V has historically implemented character ranges using the syntax
 .Dq Li [c-c]
 instead of the


Property changes on: trunk/usr.bin/tr/tr.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/tr/tr.c
===================================================================
--- trunk/usr.bin/tr/tr.c	2018-07-04 20:56:47 UTC (rev 11320)
+++ trunk/usr.bin/tr/tr.c	2018-07-04 20:59:54 UTC (rev 11321)
@@ -47,6 +47,7 @@
 #include <err.h>
 #include <limits.h>
 #include <locale.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -58,8 +59,8 @@
 #include "cset.h"
 #include "extern.h"
 
-STR s1 = { STRING1, NORMAL, 0, OOBCH, 0, { 0, OOBCH }, NULL, NULL };
-STR s2 = { STRING2, NORMAL, 0, OOBCH, 0, { 0, OOBCH }, NULL, NULL };
+static STR s1 = { STRING1, NORMAL, 0, OOBCH, 0, { 0, OOBCH }, NULL, NULL };
+static STR s2 = { STRING2, NORMAL, 0, OOBCH, 0, { 0, OOBCH }, NULL, NULL };
 
 static struct cset *setup(char *, STR *, int, int);
 static void usage(void);
@@ -267,14 +268,15 @@
 		 */
 		s2.str = argv[1];
 		s2.state = NORMAL;
-		for (cnt = 0; cnt < WCHAR_MAX; cnt++) {
+		for (cnt = 0; cnt < WINT_MAX; cnt++) {
 			if (Cflag && !iswrune(cnt))
 				continue;
 			if (cmap_lookup(map, cnt) == OOBCH) {
-				if (next(&s2))
+				if (next(&s2)) {
 					cmap_add(map, cnt, s2.lastch);
-				if (sflag)
-					cset_add(squeeze, s2.lastch);
+					if (sflag)
+						cset_add(squeeze, s2.lastch);
+				}
 			} else
 				cmap_add(map, cnt, cnt);
 			if ((s2.state == EOS || s2.state == INFINITE) &&



More information about the Midnightbsd-cvs mailing list