[dev] [sbase] [PATCH] Rewrite tr(1) in a sane way

From: FRIGN <dev_AT_frign.de>
Date: Fri, 9 Jan 2015 20:39:48 +0100

Hello fellow hackers,

the current tr(1)-implementation has really been giving me nightmares,
so I rewrote it.
Given POSIX really sucks in some areas, I went off the path at some
areas, but not in a way that it would break scripts.
Here's a comparison and you let me know what you prefer:

1) GNU coreutils:
-----------------

$ echo "Motörhead" | tr öo oö
M�to�rhead

What happens? coreutils-tr(1) doesn't support multibyte characters
and actually interprets ö as multiple single characters, which is
the reason why it obviously messes it up.

2) old sbase-tr:
----------------

$ echo "Motörhead" | ./tr öo oö
Mötorhead
$ echo "x x" | ./tr -s " "
usage: ./tr [-d] [-c] set1 [set2]
$ wc -l tr.c
356 tr.c

Oh geez! You can't squeeze! Well, seems like I have to use coreutils now.

3) new tr:
----------

$ echo "Motörhead" | ./tr öo oö
Mötorhead
$ echo "x x" | ./tr -s " "
x x
$ wc -l tr.c
243 tr.c

Works just fine!

Please test it and let me know what you think!

Cheers

FRIGN

-- 
FRIGN <dev_AT_frign.de>
Received on Fri Jan 09 2015 - 20:39:48 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 09 2015 - 20:48:07 CET