Rewrite tr(1) in a sane way

tr(1) always used to be a saddening part of sbase, which was
inherently broken and crufted.
But to be fair, the POSIX-standard doesn't make it very simple.
Given the current version was unfixable and broken by design, I
sat down and rewrote tr(1) very close to the concept of set theory
and the POSIX-standard with a few exceptions:

 - UTF-8: not allowed in POSIX, but in my opinion a must. This
          finally allows you to work with UTF-8 streams without
          problems or unexpected behaviour.
 - Equivalence classes: Left out, even GNU coreutils ignore them
                        and depending on LC_COLLATE, which sucks.
 - Character classes: No experiments or environment-variable-trickery.
                      Just plain definitions derived from the POSIX-
                      standard, working as expected.

I tested this thoroughly, but expect problems to show up in some
way given the wide range of input this program has to handle.
The only thing left on the TODO is to add support for literal
expressions ('\n', '\t', '\001', ...) and probably rethinking
the way [_*n] is unnecessarily restricted to string2.
This commit is contained in:
FRIGN
2015-01-09 20:36:27 +01:00
committed by sin
parent 83616df6fc
commit a582cb8a2f
4 changed files with 245 additions and 329 deletions

View File

@@ -20,6 +20,7 @@ HDR =\
LIBUTF = libutf.a
LIBUTFSRC =\
libutf/chartorunearr.c\
libutf/readrune.c\
libutf/rune.c\
libutf/runetype.c\