Commit Graph

62 Commits

Author SHA1 Message Date
gutteridge b6bb9bdde9 tr.1: add a "see also" xref to ctype(3) (to align with an inline
reference), improve punctuation, etc.

XXX lines 177-191 have been commented out since they were imported in
r. 1.2 back in 1993, they should probably be re-examined, and revised
or removed.
2019-05-29 11:27:34 +00:00
leot 8d25f7611b Do not accept invalid octal character values (>= 0400).
This also avoid possible stack corruption (e.g. previously `tr -s '\400'' or
similars lead to them).

Reviewed and thanks to <pgoyette>!
2018-05-26 11:20:30 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
dholland 7c248df2ae Whitespace. 2013-08-11 01:54:35 +00:00
dholland 8d0b47d1c9 Fix another bug, relating to parsing the [=x=] syntax. 2013-08-11 01:49:40 +00:00
dholland aba78f7512 Tidy up more. This is pretty ratty code. 2013-08-11 01:42:35 +00:00
dholland 5e8eff378e Tidy up. 2013-08-11 01:29:28 +00:00
dholland 9f2ae0ea3d Pass -Wpointer-sign. 2013-08-11 01:00:13 +00:00
dholland d506ddf6f7 avoid undefined behavior. 2013-08-11 00:52:17 +00:00
dholland 8a7a973b90 Don't explicitly zero bss variables that are already zeroed. 2013-08-11 00:49:15 +00:00
dholland c47da08424 Add comments explaining how this works. 2013-08-11 00:48:37 +00:00
dholland 8b42fe334c Simplify the parser handling. 2013-08-11 00:39:22 +00:00
dholland e141bc4323 Remove silly written-out initialization of string1. 2013-08-11 00:34:09 +00:00
dholland 848d757378 Make tr -c work. Fixes PR 48113.
When -c is in effect, scan string1 first, complement it, and then
iterate over the results while scanning string2. Otherwise, scan
string1 and string2 together as before.
2013-08-11 00:28:46 +00:00
dholland 567ab40d47 apply some CSE 2013-08-11 00:12:47 +00:00
dholland 9dd74a9973 Restore preexisting wrong behavior of tr -c (translates all characters
to the last letter in string2) instead of a different wrong behavior
(translates all characters to 0xff) accidentally just introduced.
2013-08-11 00:11:46 +00:00
dholland 48dbbc109e sprinkle const 2013-08-11 00:05:49 +00:00
dholland 7f7f549599 Make the parser state opaque. While here, fix a memory leak when using
the [:foo:] syntax.
2013-08-11 00:04:14 +00:00
dholland d05d2aa5a7 Expose less of the parser state outside str.c. 2013-08-10 23:54:41 +00:00
dholland 3c77b25ade punctuation usage 2013-08-10 20:59:27 +00:00
wiz 72c9578c5d Expand "it's", and fix fix convention notation.
From Bug Hunting.
2013-05-29 15:08:30 +00:00
wiz 8e553084e0 - Improve wording and punctuation;
- use `.Ex' macro for `EXIT STATUS' section;
- add `SEE ALSO' section, referencing (back) dd(1) and sed(1);
- bump date.

From Bug Hunting.
2013-05-29 15:04:37 +00:00
joerg 9edf9a0457 Remove many HAVE_GCC || HAVE_PCC conditionals as the options also apply
to Clang. Add a few cases of HAVE_LLVM for -fno-strict-aliasing.
2012-08-10 12:10:27 +00:00
christos 6438f483a9 revert previous; don't change the logic. 2011-09-08 12:00:26 +00:00
christos 90932ffc48 don't forget to 0 init the rest of the array since now we removed the memset 2011-09-08 01:19:52 +00:00
christos 47ecf56863 a little more KNF, plus add \e (from the previous commit) 2011-09-08 01:18:44 +00:00
christos 0ffd30a090 It is pointless to assign to the CLASS.set member and never use it again.
Perhaps the author meant to check if it is already set and not allocated it
again to avoid memory leaks? Anyway make everything const back and delete
the unused code. Yes, this leaks the same way as before but it is
insignificant. If we want to save memory we could use bytes or even bits
instead of ints, and not allocate/initialize the same thing multiple times.
2011-09-08 01:18:05 +00:00
joerg 91a068001c Add comment to explain the const issue to avoid future trouble. 2011-09-07 22:59:19 +00:00
riz 958c749ae4 Remove newly-introduced const qualifier from static CLASS classes[],
as CLASS->set gets changed in genclass().  Fixes a segfault doing:

tr '[:lower:]' '[:upper:]'

on (at least) amd64.
2011-09-07 18:21:41 +00:00
joerg 1d57801981 ANSIfy. Sprinkle const and __dead. 2011-09-06 18:33:46 +00:00
mrg 75e42fa7da remove most of the remaining HAVE_GCC tests that are always true in
the modern world.
2011-06-20 07:43:56 +00:00
joerg 2ec9715635 Do not use \." for comments, always use .\". Discussed with uwe@. 2009-11-12 00:43:52 +00:00
joerg de2e5c0dbd Fix markup. 2009-08-22 00:23:02 +00:00
lukem 7acf67f489 Fix WARNS=4 (-Wcast-qual -Wextra) 2009-04-13 23:50:49 +00:00
gmcgarry 3c9a95916d Wrap compiler-specific flags with HAVE_GCC and HAVE_PCC as necessary. Add a few flags for PCC. 2008-08-29 00:02:21 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
hubertf 48b31403c5 Remove duplicate #includes
From Slava Semushin <slava.semushin@gmail.com>, via private mail
2007-01-17 00:21:43 +00:00
wiz bcbefab5bf "is be" -> "is" 2006-09-17 12:15:20 +00:00
mrg 20265245bf use -Wno-pointer-sign with GCC4. 2006-05-12 01:26:05 +00:00
wiz 59757c426a As in other man pages, use .Dq for strings, and .Sq for single characters.
Add a comma after e.g.. Replace .sp with .Pp.
2004-03-24 11:38:27 +00:00
fair c223370599 Document that tr(1) was written for US-ASCII and may not work as
expected on other character sets which do not share ASCII's properties
(e.g. a symmetric set of capital and lower case characters), per PR 18738

Change all double quotes to nroff macros.
Change "System V" references to the .At macro.
2004-03-24 06:35:53 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
jmmv 7efaf55594 Add the EXIT STATUS section header. 2003-07-20 14:20:34 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
ross 2a76afae02 Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:36:18 +00:00
wiz 9a11884a17 Punctuation nit. 2001-12-08 19:19:20 +00:00
wiz aded0d2cce Whitespace cleanup. 2001-12-01 16:43:07 +00:00
kleink a7a759c81e Correct the ctype function used for [:print:] character class; from Soren S.
Jorvang in PR bin/7167.
1999-03-16 14:57:48 +00:00
perry 34a98169f0 macroize BSD, NetBSD, FreeBSD and misc cleanup 1998-02-06 05:54:12 +00:00
lukem 7e4d6ea181 WARNSify, fix .Nm usage, getopt returns -1 not EOF, use <err.h> 1997-10-20 00:56:04 +00:00