summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorEric Andersen2000-07-10 16:38:50 +0000
committerEric Andersen2000-07-10 16:38:50 +0000
commita03d86cf5496a24ccf81bfbf8fdbb10b1ad13a0a (patch)
tree2aa0b95f63205b067eac7ef738ba4f41620474c3 /coreutils
parent44735f874437ee4b570a6780c1f879de80e80fdc (diff)
downloadbusybox-a03d86cf5496a24ccf81bfbf8fdbb10b1ad13a0a.zip
busybox-a03d86cf5496a24ccf81bfbf8fdbb10b1ad13a0a.tar.gz
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
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/tr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 48cdd47..5a8116d 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -187,10 +187,12 @@ extern int tr_main(int argc, char **argv)
expand(argv[index++], input);
if (com_fl)
complement(input);
- if (argv[index] != NULL)
+ if (argv[index] != NULL) {
+ if (*argv[index] == '\0')
+ fatalError("tr: STRING2 cannot be empty\n");
expand(argv[index], output);
- if (argv[index] != NULL)
map(input, output);
+ }
for (ptr = input; *ptr; ptr++)
invec[*ptr] = TRUE;
for (ptr = output; *ptr; ptr++)