diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-07-10 16:38:50 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-07-10 16:38:50 +0000 |
commit | a03d86cf5496a24ccf81bfbf8fdbb10b1ad13a0a (patch) | |
tree | 2aa0b95f63205b067eac7ef738ba4f41620474c3 | |
parent | 44735f874437ee4b570a6780c1f879de80e80fdc (diff) | |
download | busybox-w32-a03d86cf5496a24ccf81bfbf8fdbb10b1ad13a0a.tar.gz busybox-w32-a03d86cf5496a24ccf81bfbf8fdbb10b1ad13a0a.tar.bz2 busybox-w32-a03d86cf5496a24ccf81bfbf8fdbb10b1ad13a0a.zip |
Patch from Matt Kraai <kraai@alumni.carnegiemellon.edu>:
GNU tr complains on the following:
$ tr a ''
tr: when not truncating set1, string2 must be non-empty
BusyBox tr does not complain:
$ tr a ''
a
^D
0
It should result in an error, not in some spurious output. The attached
patch generates an error.
Matt
-rw-r--r-- | coreutils/tr.c | 6 | ||||
-rw-r--r-- | tr.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/coreutils/tr.c b/coreutils/tr.c index 48cdd47bd..5a8116db0 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -187,10 +187,12 @@ extern int tr_main(int argc, char **argv) | |||
187 | expand(argv[index++], input); | 187 | expand(argv[index++], input); |
188 | if (com_fl) | 188 | if (com_fl) |
189 | complement(input); | 189 | complement(input); |
190 | if (argv[index] != NULL) | 190 | if (argv[index] != NULL) { |
191 | if (*argv[index] == '\0') | ||
192 | fatalError("tr: STRING2 cannot be empty\n"); | ||
191 | expand(argv[index], output); | 193 | expand(argv[index], output); |
192 | if (argv[index] != NULL) | ||
193 | map(input, output); | 194 | map(input, output); |
195 | } | ||
194 | for (ptr = input; *ptr; ptr++) | 196 | for (ptr = input; *ptr; ptr++) |
195 | invec[*ptr] = TRUE; | 197 | invec[*ptr] = TRUE; |
196 | for (ptr = output; *ptr; ptr++) | 198 | for (ptr = output; *ptr; ptr++) |
@@ -187,10 +187,12 @@ extern int tr_main(int argc, char **argv) | |||
187 | expand(argv[index++], input); | 187 | expand(argv[index++], input); |
188 | if (com_fl) | 188 | if (com_fl) |
189 | complement(input); | 189 | complement(input); |
190 | if (argv[index] != NULL) | 190 | if (argv[index] != NULL) { |
191 | if (*argv[index] == '\0') | ||
192 | fatalError("tr: STRING2 cannot be empty\n"); | ||
191 | expand(argv[index], output); | 193 | expand(argv[index], output); |
192 | if (argv[index] != NULL) | ||
193 | map(input, output); | 194 | map(input, output); |
195 | } | ||
194 | for (ptr = input; *ptr; ptr++) | 196 | for (ptr = input; *ptr; ptr++) |
195 | invec[*ptr] = TRUE; | 197 | invec[*ptr] = TRUE; |
196 | for (ptr = output; *ptr; ptr++) | 198 | for (ptr = output; *ptr; ptr++) |