Commit Graph

70 Commits

Author SHA1 Message Date
ru
aeb789985a - 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
stefanf
60b910d7c2 Remove unused variables. 2005-04-09 14:31:41 +00:00
ru
6b6b8c04f6 Expand contractions. 2005-02-13 23:45:54 +00:00
ru
7f3c7f0d46 Sort sections. 2005-01-18 13:43:56 +00:00
ru
6cc4b6c220 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
ru
6958048f64 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
jkh
05757f7ee0 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
tjr
61bafd2e3d 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
tjr
2322892e0b 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
tjr
084c37915e Fix description of cmap_lookup_hard(). 2004-07-14 08:36:09 +00:00
tjr
ca547df2d3 Remove unused member of struct csclass: csc_value. 2004-07-14 08:35:11 +00:00
tjr
953a00fce4 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
tjr
3f97d8af9c Initialize cs_invert to "false" in new csets. 2004-07-10 06:28:18 +00:00
tjr
3e5d71bd1a Report input errors instead of ignoring them. 2004-07-09 05:15:46 +00:00
tjr
d7311fa844 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
tjr
d291df1e3f 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
ru
fb1d8b3724 Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
tjr
2c569caec5 Document incorrect handling of multibyte characters in input files
and character string arguments.
2004-06-28 07:19:11 +00:00
ache
e771f43084 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
ache
1bdac03b07 Clarify upper/lower conversion description more. 2003-08-05 07:53:28 +00:00
ache
3a19fb4eb0 Explain better what happens when [:lower:] <-> [:upper:] 2003-08-05 06:00:00 +00:00
ache
71cdd2eb3d 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
ache
fbdcc3c060 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
ache
e98015074a 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
ache
a506e844d1 Microoptimization of prev. patch: do strdup() only if (cflag || Cflag) 2003-08-03 22:19:43 +00:00
ache
a6e8918154 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
ache
80172fba76 Remove charcoll() stabilization added in 1.16, it gains nothing but conflicts
with ranges.
2003-08-03 04:18:07 +00:00
ache
b97366a236 POSIX requires 'c-c' must conform collate and be in collation order 2003-08-03 03:51:27 +00:00
ache
0113a19ead 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
schweikh
86f7487fb6 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
ru
b67068895d mdoc(7) police: markup polishing.
Approved by:	re
2002-11-26 17:33:37 +00:00
charnier
dcefc83b9c Use .Fl/Ar for flags and arguments. 2002-10-17 13:04:49 +00:00
dwmalone
b4339b74ad 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
tjr
6d20181e60 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
tjr
fb4f03d256 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
tjr
3594350f00 Use err instead of errx when malloc fails. "malloc" is not a helpful
error message.
2002-07-05 09:28:13 +00:00
tjr
361d0dd8a7 Improve parsing of character and equivalence classes:
[:*] and [=*] are parsed as `infinitely many repetitions of :' (or *)
instead of literal characters (SUSv3)
2002-06-15 07:38:27 +00:00
tjr
1fa61e7038 Move the #include and #define's to the top of the file. 2002-06-14 15:56:52 +00:00
tjr
38575dbfdf Bump the size of the equivalence set to NCHARS; this file was left out
of a previous commit implementing equivalence classes.
2002-06-14 15:53:38 +00:00
tjr
f8e6c7f292 Sort sections. Avoid using "The -? option" at the start of option descriptions. 2002-06-14 10:11:41 +00:00
tjr
5a8b5dcfa4 Don't treat the trailing ']' of an equivalence class expression as a
character in the set. tr -d '[=a=]' was deleting ]'s as well as a's.
Noticed by the textutils test suite.
2002-06-14 09:53:11 +00:00
tjr
29924b60f3 Add the P1003.1-2001 -C option which complements the set of characters
(not byte values) specified by the first string argument.
2002-06-14 08:58:30 +00:00
tjr
0c8a9db6f9 Implement support for equivalence classes ([=e=]) when the mapping is
one-to-one (SUSv3)
2002-06-14 07:37:08 +00:00
imp
0b20191705 remove __P 2002-03-22 01:42:45 +00:00
alfred
4461fe4699 properly handle zero length first string when doing -c
PR: 34663
MFC After: 3 days
2002-03-02 10:36:37 +00:00
markm
eddee66a58 WARNS=2 fixes, use __FBSDID(), kill register keyword. 2001-12-11 23:36:25 +00:00
ru
bde8ec1b70 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
ru
24c7b0a61d mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
dd
911ca14c87 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
ru
83c24735dc mdoc(7) police: -column lists require column width specifiers. 2001-07-06 10:07:43 +00:00