Introduction
Introduction Statistics Contact Development Disclaimer Help
tr: fix behavior of cflag when using character classes - sbase - suckless unix …
git clone git://git.suckless.org/sbase
Log
Files
Refs
README
LICENSE
---
commit f14887c76522b3a5d375351b6aa8432430447f6a
parent 0b4c2ceb2f4594cc9d5ca09e39fb57f6e4f82bfb
Author: noneofyourbusiness <[email protected]>
Date: Sun, 6 Aug 2023 22:50:25 +0200
tr: fix behavior of cflag when using character classes
a simple test case:
printf ab3 | tr -c '[:alpha:]' '\n'
output should be ab<newline>, previously you would find just newlines.
Signed-off-by: noneofyourbusiness <[email protected]>
Diffstat:
M tr.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/tr.c b/tr.c
@@ -250,12 +250,10 @@ read:
}
}
if (set1check && set1check(r)) {
- if (dflag) {
- if (cflag)
- goto write;
- else
- goto read;
- }
+ if (cflag)
+ goto write;
+ if (dflag)
+ goto read;
if (set2check) {
if (set2check == islowerrune)
r = tolowerrune(r);
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.