History log of /freebsd-current/usr.bin/tr/tr.c
Revision Date Author Comments
# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# bdcbfde3 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# e5d258c9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .c pattern

Remove /^#include\s+<sys/cdefs.h>.*$\n\s+__FBSDID\("\$FreeBSD\$"\);\n/


# cccdaf50 07-Jul-2023 Alfonso Gregory <gfunni234@gmail.com>

Mark usage function as __dead2 in programs where it does not return

In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735


# 7672a014 19-Jun-2018 Mariusz Zaborski <oshogbo@FreeBSD.org>

Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.

No functional change intended.


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# a4e3fc54 07-Oct-2016 Mariusz Zaborski <oshogbo@FreeBSD.org>

Remove the duplicated code using Capsicum helpers.

Reviewed by: cem, ed, bapt, emaste
Differential Revision https://reviews.freebsd.org/D8140


# d36899d1 19-Sep-2016 Conrad Meyer <cem@FreeBSD.org>

Move sys/capsicum.h includes after types.h or param.h

This is not actually documented or even implied in style(9). Make the change
to match convention. Someone should document this convention in style(9).

Reported by: jhb
Sponsored by: EMC Dell Isilon


# 875cba63 19-Sep-2016 Conrad Meyer <cem@FreeBSD.org>

tr(1): Capsicumify

This is a straightforward single input, single output program for
capsicum.

Reviewed by: bapt
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D7928


# c4c8ae8b 14-Jul-2016 Andrey A. Chernov <ache@FreeBSD.org>

Optimize [Cc]flag case: don't repeatedly add the last character of
string2 to squeeze cset when string2 reach its EOS state.


# 5b4fa425 14-Jul-2016 Andrey A. Chernov <ache@FreeBSD.org>

Back out non-collating [a-z] ranges (r302594).
Instead of changing the whole course to another POSIX-permitted way
for consistency and uniformity I decide to completely ignore missing
regex fucntionality and focus on fixing bugs in what we have now,
too many small obstacles we have choicing other way, counting ports.
Corresponding libc changes are backed out in r302824.


# 8e0303b0 13-Jul-2016 Andrey A. Chernov <ache@FreeBSD.org>

Fully back out r302594 case 2) since overflow may happens.


# 75a1631e 11-Jul-2016 Andrey A. Chernov <ache@FreeBSD.org>

Undo r302599 and partially r302594 case 2):
since WCHAR_MAX can be not a valid wchar value, it is easier to stay
inside wint_t.


# 1cdf6eaa 11-Jul-2016 Andrey A. Chernov <ache@FreeBSD.org>

Cast WCHAR_MAX to wint_t, it can be unsigned on some systems.


# 1ef4039a 11-Jul-2016 Andrey A. Chernov <ache@FreeBSD.org>

1) Following r302512 (remove collation support for [a-z]-ranges in libc)
remove collation support for a-z ranges here too.
It was implemented for single byte locales only in any case.

2) Reduce [Cc]flag loop to WCHAR_MAX, WINT_MAX here includes WEOF which is
not a character.

3) Optimize [Cc]flag case: don't repeatedly add the last character of
string2 to squeeze cset when string2 reach its EOS state.

4) Reflect in the manpage that [=equiv=] is implemented for single
byte locales only.


# f792cb87 21-Jan-2013 Andrew Turner <andrew@FreeBSD.org>

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.


# 1dca6e4e 06-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Add missing static keywords to tr(1)


# da52b4ca 11-Dec-2010 Joel Dahl <joel@FreeBSD.org>

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


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 821df508 12-Dec-2009 Xin LI <delphij@FreeBSD.org>

Revert most part of 200420 as requested, as more review and polish is
needed.


# 6f2d3221 11-Dec-2009 Xin LI <delphij@FreeBSD.org>

Remove unneeded header includes from usr.bin/ except contributed code.

Tested with: make universe


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 6c97c3d1 09-Apr-2005 Stefan Farfeleder <stefanf@FreeBSD.org>

Remove unused variables.


# 94098353 08-Jul-2004 Tim J. Robbins <tjr@FreeBSD.org>

Report input errors instead of ignoring them.


# ca99cfdd 08-Jul-2004 Tim J. Robbins <tjr@FreeBSD.org>

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).


# 79626341 03-Aug-2003 Andrey A. Chernov <ache@FreeBSD.org>

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.


# d7da7302 03-Aug-2003 Andrey A. Chernov <ache@FreeBSD.org>

Microoptimization of prev. patch: do strdup() only if (cflag || Cflag)


# e42eb683 03-Aug-2003 Andrey A. Chernov <ache@FreeBSD.org>

1) Fix -C - it was broken since introduced, wrong array sorted
2) Fix last (repeated) char after [:class:], it was \0 in original code


# 761c008c 02-Aug-2003 Andrey A. Chernov <ache@FreeBSD.org>

Remove charcoll() stabilization added in 1.16, it gains nothing but conflicts
with ranges.


# 00611f04 02-Aug-2003 Andrey A. Chernov <ache@FreeBSD.org>

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.


# f4ac32de 04-Sep-2002 David Malone <dwmalone@FreeBSD.org>

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


# 6e9c52b6 29-Jul-2002 Tim J. Robbins <tjr@FreeBSD.org>

When translating and -C is specified, behave as if the complemented set was
in the locale collating order as required by SUSv3.


# 482711cf 29-Jul-2002 Tim J. Robbins <tjr@FreeBSD.org>

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).


# dfac4f36 14-Jun-2002 Tim J. Robbins <tjr@FreeBSD.org>

Add the P1003.1-2001 -C option which complements the set of characters
(not byte values) specified by the first string argument.


# 85f6c317 14-Jun-2002 Tim J. Robbins <tjr@FreeBSD.org>

Implement support for equivalence classes ([=e=]) when the mapping is
one-to-one (SUSv3)


# 3f330d7d 21-Mar-2002 Warner Losh <imp@FreeBSD.org>

remove __P


# 40e8dd71 02-Mar-2002 Alfred Perlstein <alfred@FreeBSD.org>

properly handle zero length first string when doing -c

PR: 34663
MFC After: 3 days


# 78732475 11-Dec-2001 Mark Murray <markm@FreeBSD.org>

WARNS=2 fixes, use __FBSDID(), kill register keyword.


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 69bd8767 12-Oct-1997 Wolfgang Helbig <helbig@FreeBSD.org>

Submitted by: Joachim Kuebart, thanks.
Add -u option to force unbuffered output


# af647767 18-Aug-1997 Philippe Charnier <charnier@FreeBSD.org>

Use err(3) instead of local redefinition. Cosmetic in usage().


# 1c8af878 28-Mar-1997 Warner Losh <imp@FreeBSD.org>

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# df3f5d9d 11-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Merge from Lite2


# 0da30e9a 11-Mar-1997 Peter Wemm <peter@FreeBSD.org>

Import some parts of CSRG 4.4BSD-Lite2 usr.bin sources to fix tree build.


# 199482ea 28-Oct-1995 Andrey A. Chernov <ache@FreeBSD.org>

Fix broken charclass handling
Add setlocale LC_CTYPE


# 7799f52a 30-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# 9b50d902 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Usr.bin Sources