[hackers] [sbase] tr(1): Properly handle the -dc case for character classes || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Thu, 6 Oct 2016 00:16:51 +0200 (CEST)

commit c154ef7a0399b9ca0bbea96a044841657d743ea0
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Thu Oct 6 00:15:56 2016 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Thu Oct 6 00:16:30 2016 +0200

    tr(1): Properly handle the -dc case for character classes
    
    I actually did that properly in the set-case but forgot to add the same
    logic to the character classes. Now it should work fine.

diff --git a/tr.c b/tr.c
index 29c9445..3aef53e 100644
--- a/tr.c
+++ b/tr.c
_AT_@ -248,8 +248,12 @@ read:
                 }
         }
         if (set1check && set1check(r)) {
- if (dflag && !cflag)
- goto read;
+ if (dflag) {
+ if (cflag)
+ goto write;
+ else
+ goto read;
+ }
                 if (set2check) {
                         if (set2check == islowerrune)
                                 r = tolowerrune(r);
_AT_@ -258,6 +262,7 @@ read:
                 } else {
                         r = set2[set2ranges - 1].end;
                 }
+ goto write;
         }
         if (!dflag && cflag) {
                 if (set2check) {
Received on Thu Oct 06 2016 - 00:16:51 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 06 2016 - 00:24:16 CEST