summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2000-12-06 22:53:06 +0000
committerEric Andersen2000-12-06 22:53:06 +0000
commit8ffabf5825e68f25c08ee6d804cf8e77035ef27d (patch)
treebecf91e1b6467562965461eab3a5d9363168a2ba
parent1d3523b7aa994aeb90fec5f281617abc3c9ce195 (diff)
downloadbusybox-8ffabf5825e68f25c08ee6d804cf8e77035ef27d.zip
busybox-8ffabf5825e68f25c08ee6d804cf8e77035ef27d.tar.gz
Patch from Matt Kraai to fix 'echo "1 2 3" | tr -s " "'
so it properly outputs "1 2 3".
-rw-r--r--coreutils/tr.c2
-rw-r--r--tr.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 54b6abc..96e2c2b 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 54b6abc..96e2c2b 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) {