diff --git a/build.rs b/build.rs index 923b2f44d1a..39608096e95 100644 --- a/build.rs +++ b/build.rs @@ -50,6 +50,9 @@ pub fn main() { "chcon" | "runcon" if !(target_os == "linux" || target_os == "android") => { continue; } + "who" if target_os == "openbsd" => { + continue; + } "default" | "macos" | "unix" | "windows" | "selinux" | "zip" | "clap_complete" | "clap_mangen" | "fluent_syntax" | "openssl" => continue, // common/standard feature names "nightly" | "test_unimplemented" | "expensive_tests" | "test_risky_names" => { diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index c3c36788106..ceacbe5706e 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -18,7 +18,7 @@ path = "src/who.rs" test = false doctest = false -[dependencies] +[target.'cfg(any(target_vendor = "apple", target_os = "cygwin", target_os = "freebsd", target_os = "linux", target_os = "netbsd"))'.dependencies] clap = { workspace = true } fluent = { workspace = true } rustix = { workspace = true, features = ["fs", "termios"] } @@ -33,3 +33,4 @@ workspace = true [[bin]] name = "who" path = "src/main.rs" +required-features = ["uucore/default"] diff --git a/src/uu/who/locales/en-US.ftl b/src/uu/who/locales/en-US.ftl index 2984c2fdcc5..cca15b31852 100644 --- a/src/uu/who/locales/en-US.ftl +++ b/src/uu/who/locales/en-US.ftl @@ -54,6 +54,3 @@ who-heading-exit = EXIT # Error messages who-canonicalize-error = failed to canonicalize { $host } - -# Platform-specific messages -who-unsupported-openbsd = unsupported command on OpenBSD diff --git a/src/uu/who/locales/fr-FR.ftl b/src/uu/who/locales/fr-FR.ftl index 0c853e51ee9..5cfb7c2d233 100644 --- a/src/uu/who/locales/fr-FR.ftl +++ b/src/uu/who/locales/fr-FR.ftl @@ -53,6 +53,3 @@ who-heading-exit = SORTIE # Error messages who-canonicalize-error = échec de canonicalisation de { $host } - -# Platform-specific messages -who-unsupported-openbsd = commande non prise en charge sur OpenBSD diff --git a/src/uu/who/src/platform/mod.rs b/src/uu/who/src/platform/mod.rs index e0e87dca1bf..906b7e7dbb9 100644 --- a/src/uu/who/src/platform/mod.rs +++ b/src/uu/who/src/platform/mod.rs @@ -3,12 +3,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -#[cfg(not(target_os = "openbsd"))] mod unix; -#[cfg(not(target_os = "openbsd"))] -pub use self::unix::*; -#[cfg(target_os = "openbsd")] -mod openbsd; -#[cfg(target_os = "openbsd")] -pub use self::openbsd::*; +pub use self::unix::*; diff --git a/src/uu/who/src/platform/openbsd.rs b/src/uu/who/src/platform/openbsd.rs deleted file mode 100644 index f5871382b11..00000000000 --- a/src/uu/who/src/platform/openbsd.rs +++ /dev/null @@ -1,17 +0,0 @@ -// This file is part of the uutils coreutils package. -// -// For the full copyright and license information, please view the LICENSE -// file that was distributed with this source code. - -// Specific implementation for OpenBSD: tool unsupported (utmpx not supported) - -use crate::uu_app; - -use uucore::error::UResult; -use uucore::translate; - -pub fn uumain(args: impl uucore::Args) -> UResult<()> { - let _matches = uucore::clap_localization::handle_clap_result(uu_app(), args)?; - println!("{}", translate!("who-unsupported-openbsd")); - Ok(()) -} diff --git a/src/uu/who/src/who.rs b/src/uu/who/src/who.rs index e82990b7924..6ca983200e9 100644 --- a/src/uu/who/src/who.rs +++ b/src/uu/who/src/who.rs @@ -5,6 +5,14 @@ // spell-checker:ignore (ToDO) runlevel mesg +#![cfg(any( + target_vendor = "apple", + target_os = "cygwin", + target_os = "freebsd", + target_os = "linux", + target_os = "netbsd" +))] + use clap::{Arg, ArgAction, Command}; use uucore::format_usage; use uucore::translate;