summaryrefslogtreecommitdiffstats
path: root/usr.bin/tr/str.c
Commit message (Collapse)AuthorAgeFilesLines
* Replace index() and rindex() calls with strchr() and strrchr().ed2012-01-031-1/+1
| | | | | | | | | | 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.
* Build tr(1) with WARNS=6.ed2011-10-141-10/+5
|
* Remove the advertising clause from UCB copyrighted files in usr.bin. Thisjoel2010-12-111-4/+0
| | | | | | | | | 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
* tr: Fix '[=]=]' equivalence class.jilles2010-09-291-1/+1
| | | | | | | | | | | 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
* Revert most part of 200420 as requested, as more review and polish isdelphij2009-12-131-0/+2
| | | | needed.
* Remove unneeded header includes from usr.bin/ except contributed code.delphij2009-12-111-2/+0
| | | | Tested with: make universe
* o Remove duplicate includes.maxim2007-01-201-1/+0
| | | | Obtained from: Slava Semushin via NetBSD
* tr(1) attempts to convert \n[n][n] sequences into octal digits, but doesn'tjkh2004-11-141-1/+1
| | | | | | | | 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
* Add support for multibyte characters. The challenge here was to usetjr2004-07-091-86/+77
| | | | | | | | | | | | | | 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).
* Back out [:upper:] and [:lower:] classes sorting, it is not requiredache2003-08-051-6/+3
| | | | by POSIX and gains nothing with current code.
* No functional changes, just code reorganization from prev. commit, itache2003-08-041-11/+17
| | | | | | makes one malloc unneeded, removes two bzero's and makes code more readable. "Bright ideas comes only _after_ commits."
* POSIX require complex processing of 'c-c' ranges: if one of the endpointsache2003-08-041-21/+36
| | | | | | | 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.
* 1) Fix -C - it was broken since introduced, wrong array sortedache2003-08-031-1/+2
| | | | 2) Fix last (repeated) char after [:class:], it was \0 in original code
* POSIX requires 'c-c' must conform collate and be in collation orderache2003-08-031-12/+17
|
* This patch address two problems.ache2003-08-031-2/+12
| | | | | | | | | | | | | | | | 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.
* Use err instead of errx when malloc fails. "malloc" is not a helpfultjr2002-07-051-1/+1
| | | | error message.
* Improve parsing of character and equivalence classes:tjr2002-06-151-4/+9
| | | | | [:*] and [=*] are parsed as `infinitely many repetitions of :' (or *) instead of literal characters (SUSv3)
* Don't treat the trailing ']' of an equivalence class expression as atjr2002-06-141-1/+2
| | | | | character in the set. tr -d '[=a=]' was deleting ]'s as well as a's. Noticed by the textutils test suite.
* Implement support for equivalence classes ([=e=]) when the mapping istjr2002-06-141-4/+25
| | | | one-to-one (SUSv3)
* remove __Pimp2002-03-221-9/+9
|
* WARNS=2 fixes, use __FBSDID(), kill register keyword.markm2001-12-111-26/+28
|
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Use err(3) instead of local redefinition. Cosmetic in usage().charnier1997-08-181-9/+13
|
* Cast char's to (u_char) before passing them to isctype() functions.joerg1996-03-191-2/+2
|
* Fix a couple of sign-extension bugs.joerg1996-03-171-2/+2
| | | | Submitted by: serg@bcs1.bcs.zaporizhzhe.ua (Sergey Shkonda)
* Updated to BSD4.4lite2. Fixes PR836. `echo abcd | tr a-d A-BC-D' nowbde1995-11-281-3/+3
| | | | works.
* Fix broken charclass handlingache1995-10-281-3/+12
| | | | Add setlocale LC_CTYPE
* Remove declamations which <ctype.h> already does for us.phk1995-10-211-13/+0
|
* Added #include <ctype.h>phk1995-10-211-0/+1
|
* Fix print class mistypeache1994-10-281-1/+1
|
* BSD 4.4 Lite Usr.bin Sourcesrgrimes1994-05-271-0/+342
OpenPOWER on IntegriCloud