Skip to content

Commit 706751a

Browse files
committed
coreutils: Let the name *utils valid
1 parent fdb7bd7 commit 706751a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/bin/coreutils.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@ fn main() {
5252
});
5353

5454
// binary name ends with util name?
55+
let is_coreutils = binary_as_util.ends_with("utils");
5556
let matched_util = utils
5657
.keys()
57-
.filter(|&&u| binary_as_util.ends_with(u) && !binary_as_util.ends_with("coreutils"))
58-
.max_by_key(|u| u.len()); //Prefer stty more than tty. coreutils is not ls
58+
.filter(|&&u| binary_as_util.ends_with(u) && !is_coreutils)
59+
.max_by_key(|u| u.len()); //Prefer stty more than tty. *utils is not ls
5960

6061
let util_name = if let Some(&util) = matched_util {
6162
Some(OsString::from(util))
62-
} else if binary_as_util.ends_with("utils") || binary_as_util.ends_with("box") {
63+
} else if is_coreutils || binary_as_util.ends_with("box") {
6364
// todo: Remove support of "*box" from binary
6465
uucore::set_utility_is_second_arg();
6566
args.next()

0 commit comments

Comments
 (0)