Commit Graph

85 Commits

Author SHA1 Message Date
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Julio Merino
3a92d97ff0 Migrate most of tools/regression/usr.bin/ to the new tests layout.
I'm starting with the easy cases.  The leftovers need to be looked at a
bit more closely.

Note that this change _does_ modify the code of the old tests.  This is
required in order to allow the code to locate the data files in the
source directory instead of the current directory, because Kyua
automatically changes the latter to a temporary directory.

Also note that at least one test is known to be broken here.  Actually,
the test is not really broken: it's marked as a TODO but unfortunately
Kyua's TAP parser currently does not understand that.  Will have to be
fixed separately.
2014-03-16 08:04:06 +00:00
Andrew Turner
f792cb87f2 When copying the complement of the string loop to WINT_MAX as we are dealing
with a wint_t. WINT_MAX and WCHAR_MAX are the same on most architectures
except ARM EABI where wint_t is signed and wchar_t is unsigned.
2013-01-22 05:39:34 +00:00
Joel Dahl
c2965cd185 mdoc: terminate quoted strings.
Reviewed by:	brueffer
2012-03-26 15:18:14 +00:00
Joel Dahl
126b754db4 Remove superfluous paragraph macro. 2012-03-25 09:19:25 +00:00
Ed Schouten
b3608ae18f Replace index() and rindex() calls with strchr() and strrchr().
The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.
2012-01-03 18:51:58 +00:00
Ed Schouten
1dca6e4e8a Add missing static keywords to tr(1) 2011-11-06 08:17:42 +00:00
Ed Schouten
50af444a74 Put parentheses in the right place.
Noted by:	jilles@
Broken by:	me. :-(
2011-10-14 10:43:55 +00:00
Ed Schouten
b173dd440b Build tr(1) with WARNS=6. 2011-10-14 07:25:20 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Jilles Tjoelker
88deede54a tr: Fix '[=]=]' equivalence class.
A closing bracket immediately after '[=' should not be treated as special.

Different from the submitted patch, a string ending with '[=' does not cause
access beyond the terminating '\0'.

PR:		bin/150384
Submitted by:	Richard Lowe
MFC after:	2 weeks
2010-09-29 22:24:18 +00:00
Ed Schouten
b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Xin LI
821df508e8 Revert most part of 200420 as requested, as more review and polish is
needed.
2009-12-13 03:14:06 +00:00
Xin LI
6f2d322192 Remove unneeded header includes from usr.bin/ except contributed code.
Tested with:	make universe
2009-12-11 23:35:38 +00:00
Maxim Konovalov
ba5b74d001 o Remove duplicate includes.
Obtained from:	Slava Semushin via NetBSD
2007-01-20 08:24:02 +00:00
Ruslan Ermilov
0414904d4c - Document all character classes our tr(1) supports. [1]
- Mention that some of them are POSIX extensions.  [2]

PR:		docs/85062 [1]
Submitted by:	Toby Peterson [1]
Obtained from:	wctype(3) [2]
MFC after:	3 days
2006-10-13 16:13:45 +00:00
Stefan Farfeleder
6c97c3d1d3 Remove unused variables. 2005-04-09 14:31:41 +00:00
Ruslan Ermilov
36a142c455 Expand contractions. 2005-02-13 23:45:54 +00:00
Ruslan Ermilov
6c7216df78 Sort sections. 2005-01-18 13:43:56 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Ruslan Ermilov
3baccdb9fd Formatting fixes.
(This exposes a bug in mdoc(7) for which a patch has been sent upstream.)
2005-01-11 10:32:29 +00:00
Jordan K. Hubbard
03afb27c83 tr(1) attempts to convert \n[n][n] sequences into octal digits, but doesn't
check to see that a given digit is actually an octal digit.  This leads to
unusual consequences if passed in values like \9.

Reported by:	Joseph Davison (OpenDarwin project)
MFC after:	1 week
2004-11-14 05:15:25 +00:00
Tim J. Robbins
26bdc1d12e Tweak markup of quoted strings and characters: use Dq instead of enclosing
strings in ``obsolete quotes''. Use Li and Ql where appropriate.
2004-07-23 06:06:58 +00:00
Tim J. Robbins
0b651019b4 Add a lengthy discussion of why "tr a-z A-Z" and "tr A-Z a-z" are not the
right way to perform case-conversion.
2004-07-23 05:44:04 +00:00
Tim J. Robbins
c75b843169 Fix description of cmap_lookup_hard(). 2004-07-14 08:36:09 +00:00
Tim J. Robbins
9aed43ae23 Remove unused member of struct csclass: csc_value. 2004-07-14 08:35:11 +00:00
Tim J. Robbins
cfab3bdd89 Splay the left and right subtrees on min - 1 and max + 1, respectively,
before trying to coalesce. Forgetting to splay caused us to miss many
opportunities for coalescing.
2004-07-14 08:33:14 +00:00
Tim J. Robbins
9c8fd487a5 Initialize cs_invert to "false" in new csets. 2004-07-10 06:28:18 +00:00
Tim J. Robbins
9409835314 Report input errors instead of ignoring them. 2004-07-09 05:15:46 +00:00
Tim J. Robbins
e263a4b46e Update for multibyte character support: remove BUGS and change the
description of the -c option to refer to "values" instead of "byte values".
2004-07-09 02:33:46 +00:00
Tim J. Robbins
ca99cfdd14 Add support for multibyte characters. The challenge here was to use
data structures that scale better with large character sets, instead of
arrays indexed by character value:
- Sets of characters to delete/squeeze are stored in a new "cset" structure,
which is implemented as a splay tree of extents. This structure has the
ability to store character classes (ala wctype(3)), but this is not
currently fully utilized.
- Mappings between characters are stored in a new "cmap" structure, which
is also a splay tree.
- The parser no longer builds arrays containing all the characters in a
particular class; instead, next() determines them on-the-fly using
nextwctype(3).
2004-07-09 02:08:07 +00:00
Ruslan Ermilov
6a3e8b0adc Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
Tim J. Robbins
6863e5bed2 Document incorrect handling of multibyte characters in input files
and character string arguments.
2004-06-28 07:19:11 +00:00
Andrey A. Chernov
035944c3b6 Back out [:upper:] and [:lower:] classes sorting, it is not required
by POSIX and gains nothing with current code.
2003-08-05 07:59:46 +00:00
Andrey A. Chernov
8ad968ee96 Clarify upper/lower conversion description more. 2003-08-05 07:53:28 +00:00
Andrey A. Chernov
bc44c44a14 Explain better what happens when [:lower:] <-> [:upper:] 2003-08-05 06:00:00 +00:00
Andrey A. Chernov
30c1156451 No functional changes, just code reorganization from prev. commit, it
makes one malloc unneeded, removes two bzero's and makes code more readable.

"Bright ideas comes only _after_ commits."
2003-08-04 05:22:06 +00:00
Andrey A. Chernov
21f53e9138 POSIX require complex processing of 'c-c' ranges: if one of the endpoints
is octal sequence, range is taken in the byte values order, for non-octal
endpoints range is taken in the sorted collation order.

Implement it.
2003-08-04 04:20:04 +00:00
Andrey A. Chernov
796263418b Special fix just for
tr -[cC]s '[:upper:]' '[:lower:]'
case (or vice versa):
chars taken from s2 can be different this time
due to lack of complex upper/lower processing,
so fill string2 again to not miss some.
2003-08-04 02:57:17 +00:00
Andrey A. Chernov
d7da7302f9 Microoptimization of prev. patch: do strdup() only if (cflag || Cflag) 2003-08-03 22:19:43 +00:00
Andrey A. Chernov
e42eb6838e 1) Fix -C - it was broken since introduced, wrong array sorted
2) Fix last (repeated) char after [:class:], it was \0 in original code
2003-08-03 22:02:49 +00:00
Andrey A. Chernov
761c008c99 Remove charcoll() stabilization added in 1.16, it gains nothing but conflicts
with ranges.
2003-08-03 04:18:07 +00:00
Andrey A. Chernov
a508a04d43 POSIX requires 'c-c' must conform collate and be in collation order 2003-08-03 03:51:27 +00:00
Andrey A. Chernov
00611f0457 This patch address two problems.
1st one is relatively minor: according our own manpage, upper and lower
classes must be sorted, but currently not.

2nd one is serious:
	tr '[:lower:]' '[:upper:]'
	(and vice versa) currently works only if upper and lower classes
	have exact the same number of elements. When it is not true, like for
	many ISO8859-x locales which have bigger amount of lowercase letters,
	tr may do nasty things.

	See this page
	http://www.opengroup.org/onlinepubs/007908799/xcu/tr.html
	for detailed description of desired tr behaviour in such cases.
2003-08-03 02:23:39 +00:00
Jens Schweikhardt
d64ada501a Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +00:00
Ruslan Ermilov
06e482e60a mdoc(7) police: markup polishing.
Approved by:	re
2002-11-26 17:33:37 +00:00
Philippe Charnier
b9a86ec995 Use .Fl/Ar for flags and arguments. 2002-10-17 13:04:49 +00:00
David Malone
f4ac32def2 ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by:	md5
2002-09-04 23:29:10 +00:00
Tim J. Robbins
6e9c52b638 When translating and -C is specified, behave as if the complemented set was
in the locale collating order as required by SUSv3.
2002-07-29 23:42:00 +00:00
Tim J. Robbins
482711cfa6 When translating and the -c option is specified, handle the case where the
second string argument is more than one character in length in the way
required by SUSv3 (and the way GNU textutils and SVR4 do it).
2002-07-29 14:50:54 +00:00