Patch from Matt Kraai to fix 'echo "1 2 3" | tr -s " "'

so it properly outputs "1 2 3".
This commit is contained in:
Eric Andersen 2000-12-06 22:53:06 +00:00
parent 1d3523b7aa
commit 8ffabf5825
2 changed files with 2 additions and 2 deletions

View File

@ -70,7 +70,7 @@ static void convert()
coded = vector[c]; coded = vector[c];
if (del_fl && invec[c]) if (del_fl && invec[c])
continue; continue;
if (sq_fl && last == coded && outvec[coded]) if (sq_fl && last == coded && (invec[c] || outvec[coded]))
continue; continue;
output[out_index++] = last = coded; output[out_index++] = last = coded;
if (out_index == BUFSIZ) { if (out_index == BUFSIZ) {

2
tr.c
View File

@ -70,7 +70,7 @@ static void convert()
coded = vector[c]; coded = vector[c];
if (del_fl && invec[c]) if (del_fl && invec[c])
continue; continue;
if (sq_fl && last == coded && outvec[coded]) if (sq_fl && last == coded && (invec[c] || outvec[coded]))
continue; continue;
output[out_index++] = last = coded; output[out_index++] = last = coded;
if (out_index == BUFSIZ) { if (out_index == BUFSIZ) {