[hackers] [sbase] Fix -s in tr(1) || FRIGN

From: <git_AT_suckless.org>
Date: Wed, 2 Mar 2016 10:31:17 +0100 (CET)

commit 97ce9ea586582d750af1476db8e7ef03ab698b7a
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Wed Mar 2 10:08:24 2016 +0100
Commit: sin <sin_AT_2f30.org>
CommitDate: Wed Mar 2 09:31:11 2016 +0000

    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.

diff --git a/tr.c b/tr.c
index b40f0cc..361ac40 100644
--- a/tr.c
+++ b/tr.c
_AT_@ -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++)
_AT_@ -243,6 +237,8 @@ read:
                         m--;
                         r = set2[m].start + (off1 - off2) / set2[m].quant;
 
+ if (sflag && (r == lastrune))
+ goto read;
                         goto write;
                 }
         }
Received on Wed Mar 02 2016 - 10:31:17 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 02 2016 - 10:36:30 CET