diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 5cbf58faa..9e7105b0e 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -119,13 +119,11 @@ pub fn set_utility_is_second_arg() { static ARGV: Lazy> = Lazy::new(|| wild::args_os().collect()); static UTIL_NAME: Lazy = Lazy::new(|| { - if get_utility_is_second_arg() { - &ARGV[1] - } else { - &ARGV[0] - } - .to_string_lossy() - .into_owned() + let base_index = if get_utility_is_second_arg() { 1 } else { 0 }; + let is_man = if ARGV[base_index].eq("manpage") { 1 } else { 0 }; + let argv_index = base_index + is_man; + + ARGV[argv_index].to_string_lossy().into_owned() }); /// Derive the utility name.