From: Eric Andersen Date: Wed, 6 Dec 2000 22:53:06 +0000 (-0000) Subject: Patch from Matt Kraai to fix 'echo "1 2 3" | tr -s " "' X-Git-Tag: 0_48~63 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8ffabf5825e68f25c08ee6d804cf8e77035ef27d;p=oweals%2Fbusybox.git Patch from Matt Kraai to fix 'echo "1 2 3" | tr -s " "' so it properly outputs "1 2 3". --- diff --git a/coreutils/tr.c b/coreutils/tr.c index 54b6abc8c..96e2c2b5f 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c @@ -70,7 +70,7 @@ static void convert() coded = vector[c]; if (del_fl && invec[c]) continue; - if (sq_fl && last == coded && outvec[coded]) + if (sq_fl && last == coded && (invec[c] || outvec[coded])) continue; output[out_index++] = last = coded; if (out_index == BUFSIZ) { diff --git a/tr.c b/tr.c index 54b6abc8c..96e2c2b5f 100644 --- a/tr.c +++ b/tr.c @@ -70,7 +70,7 @@ static void convert() coded = vector[c]; if (del_fl && invec[c]) continue; - if (sq_fl && last == coded && outvec[coded]) + if (sq_fl && last == coded && (invec[c] || outvec[coded])) continue; output[out_index++] = last = coded; if (out_index == BUFSIZ) {