Commit Graph

7 Commits

Author SHA1 Message Date
FRIGN
696bb992c3 Return number of bytes read even on a partial read
and set the rune to Runeerror for later checking (if desired).
2015-02-01 03:54:56 +01:00
FRIGN
f2e6af7350 Return number of bytes read in readrune()
Could be useful in some cases...
2015-02-01 03:43:54 +01:00
Hiltjo Posthuma
4469b0b641 chartorunearr: initialize ret 2015-01-10 17:00:01 +00:00
FRIGN
a582cb8a2f 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.
2015-01-10 14:26:30 +00:00
sin
18850f5dfa writerune() should operate on a FILE * 2014-11-21 16:34:57 +00:00
sin
5b5bb82ec0 Factor out readrune and writerune 2014-11-21 16:31:16 +00:00
sin
56709a2414 Import libutf from http://git.suckless.org/libutf 2014-11-17 15:46:01 +00:00