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
This commit is contained in:
parent
44735f8744
commit
a03d86cf54
@ -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++)
|
||||
|
6
tr.c
6
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++)
|
||||
|
Loading…
Reference in New Issue
Block a user