sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 18efe2d38ef6ebfd7652cc67ccf56bfd3fe41544
parent 537d5846e80e20de9ae7443529d2efe1a10081ca
Author: FRIGN <dev@frign.de>
Date:   Wed Mar  2 10:08:24 +0100

Fix -s in tr(1)

Forgot that in case there is a second argument given with -s you
probably want to have your characters substituted.
I changed it so that shortly before "deploying" we check if the
"to be written"-Rune is equal to the last Rune, and proceed as
needed.

Diffstat:
tr.c | 8++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/tr.c b/tr.c @@ -218,12 +218,6 @@ read: else goto write; } - if (sflag) { - if (r == lastrune) - goto read; - else - goto write; - } if (cflag) goto write; for (m = 0; m < i; m++) @@ -243,6 +237,8 @@ read: m--; r = set2[m].start + (off1 - off2) / set2[m].quant; + if (sflag && (r == lastrune)) + goto read; goto write; } }