1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

uutils: change every target_os = "macos" to target_vendor = "apple"

This commit is contained in:
aspen 2021-03-17 21:32:34 -04:00
parent 99be7a3172
commit 4e29b693f8
No known key found for this signature in database
GPG key ID: 9CCE5F51B2F8C465
18 changed files with 64 additions and 74 deletions

20
Cargo.lock generated
View file

@ -193,7 +193,7 @@ dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -404,7 +404,7 @@ dependencies = [
"oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "oorandom 11.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "plotters 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_cbor 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.124 (registry+https://github.com/rust-lang/crates.io-index)",
@ -517,7 +517,7 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1035,7 +1035,7 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.4.4" version = "1.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "aho-corasick 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1471,7 +1471,7 @@ version = "0.0.4"
dependencies = [ dependencies = [
"getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.7", "uucore 0.0.7",
"uucore_procs 0.0.5", "uucore_procs 0.0.5",
@ -1557,7 +1557,7 @@ dependencies = [
name = "uu_expand" name = "uu_expand"
version = "0.0.4" version = "0.0.4"
dependencies = [ dependencies = [
"getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.7", "uucore 0.0.7",
"uucore_procs 0.0.5", "uucore_procs 0.0.5",
@ -1634,7 +1634,7 @@ dependencies = [
"hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)",
"md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "md5 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)",
"sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1838,7 +1838,7 @@ dependencies = [
"getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.7", "uucore 0.0.7",
"uucore_procs 0.0.5", "uucore_procs 0.0.5",
@ -1939,7 +1939,7 @@ dependencies = [
"getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.85 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.7", "uucore 0.0.7",
"uucore_procs 0.0.5", "uucore_procs 0.0.5",
@ -2598,7 +2598,7 @@ dependencies = [
"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
"checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" "checksum redox_syscall 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9"
"checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" "checksum redox_termios 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f"
"checksum regex 1.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "54fd1046a3107eb58f42de31d656fee6853e5d276c455fd943742dce89fc3dd3" "checksum regex 1.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19"
"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" "checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4"
"checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" "checksum regex-syntax 0.6.23 (registry+https://github.com/rust-lang/crates.io-index)" = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548"
"checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"

View file

@ -164,7 +164,7 @@ fn set_main_group(group: &str) {
} }
} }
#[cfg(any(target_os = "macos", target_os = "freebsd"))] #[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
fn set_groups(groups: Vec<libc::gid_t>) -> libc::c_int { fn set_groups(groups: Vec<libc::gid_t>) -> libc::c_int {
unsafe { setgroups(groups.len() as libc::c_int, groups.as_ptr()) } unsafe { setgroups(groups.len() as libc::c_int, groups.as_ptr()) }
} }

View file

@ -32,15 +32,15 @@ use std::ffi::CString;
#[cfg(unix)] #[cfg(unix)]
use std::mem; use std::mem;
#[cfg(any(target_os = "macos", target_os = "freebsd"))] #[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
use libc::c_int; use libc::c_int;
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
use libc::statfs; use libc::statfs;
#[cfg(any(target_os = "macos", target_os = "freebsd"))] #[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
use std::ffi::CStr; use std::ffi::CStr;
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "windows"))] #[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "windows"))]
use std::ptr; use std::ptr;
#[cfg(any(target_os = "macos", target_os = "freebsd"))] #[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
use std::slice; use std::slice;
#[cfg(target_os = "freebsd")] #[cfg(target_os = "freebsd")]
@ -137,7 +137,7 @@ struct MountInfo {
#[cfg(all( #[cfg(all(
target_os = "freebsd", target_os = "freebsd",
not(all(target_os = "macos", target_arch = "x86_64")) not(all(target_vendor = "apple", target_arch = "x86_64"))
))] ))]
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
@ -209,20 +209,20 @@ fn get_usage() -> String {
format!("{0} [OPTION]... [FILE]...", executable!()) format!("{0} [OPTION]... [FILE]...", executable!())
} }
#[cfg(any(target_os = "freebsd", target_os = "macos"))] #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
extern "C" { extern "C" {
#[cfg(all(target_os = "macos", target_arch = "x86_64"))] #[cfg(all(target_vendor = "apple", target_arch = "x86_64"))]
#[link_name = "getmntinfo$INODE64"] #[link_name = "getmntinfo$INODE64"]
fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int; fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int;
#[cfg(any( #[cfg(any(
all(target_os = "freebsd"), all(target_os = "freebsd"),
all(target_os = "macos", target_arch = "aarch64") all(target_vendor = "apple", target_arch = "aarch64")
))] ))]
fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int; fn getmntinfo(mntbufp: *mut *mut statfs, flags: c_int) -> c_int;
} }
#[cfg(any(target_os = "freebsd", target_os = "macos"))] #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
impl From<statfs> for MountInfo { impl From<statfs> for MountInfo {
fn from(statfs: statfs) -> Self { fn from(statfs: statfs) -> Self {
let mut info = MountInfo { let mut info = MountInfo {
@ -585,7 +585,7 @@ fn read_fs_list() -> Vec<MountInfo> {
}) })
.collect::<Vec<_>>() .collect::<Vec<_>>()
} }
#[cfg(any(target_os = "freebsd", target_os = "macos"))] #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
{ {
let mut mptr: *mut statfs = ptr::null_mut(); let mut mptr: *mut statfs = ptr::null_mut();
let len = unsafe { getmntinfo(&mut mptr, 1 as c_int) }; let len = unsafe { getmntinfo(&mut mptr, 1 as c_int) };

View file

@ -291,7 +291,7 @@ fn pretty(possible_pw: Option<Passwd>) {
} }
} }
#[cfg(any(target_os = "macos", target_os = "freebsd"))] #[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
fn pline(possible_uid: Option<uid_t>) { fn pline(possible_uid: Option<uid_t>) {
let uid = possible_uid.unwrap_or_else(getuid); let uid = possible_uid.unwrap_or_else(getuid);
let pw = Passwd::locate(uid).unwrap(); let pw = Passwd::locate(uid).unwrap();

View file

@ -23,7 +23,7 @@ use uucore::fs::{is_stderr_interactive, is_stdin_interactive, is_stdout_interact
static NAME: &str = "nohup"; static NAME: &str = "nohup";
static VERSION: &str = env!("CARGO_PKG_VERSION"); static VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
extern "C" { extern "C" {
fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int; fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int;
} }

View file

@ -15,7 +15,7 @@ use std::env;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
pub const _SC_NPROCESSORS_CONF: libc::c_int = 83; pub const _SC_NPROCESSORS_CONF: libc::c_int = 83;
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
pub const _SC_NPROCESSORS_CONF: libc::c_int = libc::_SC_NPROCESSORS_CONF; pub const _SC_NPROCESSORS_CONF: libc::c_int = libc::_SC_NPROCESSORS_CONF;
#[cfg(target_os = "freebsd")] #[cfg(target_os = "freebsd")]
pub const _SC_NPROCESSORS_CONF: libc::c_int = 57; pub const _SC_NPROCESSORS_CONF: libc::c_int = 57;
@ -89,7 +89,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
#[cfg(any( #[cfg(any(
target_os = "linux", target_os = "linux",
target_os = "macos", target_vendor = "apple",
target_os = "freebsd", target_os = "freebsd",
target_os = "netbsd" target_os = "netbsd"
))] ))]
@ -109,7 +109,7 @@ fn num_cpus_all() -> usize {
// Other platforms (e.g., windows), num_cpus::get() directly. // Other platforms (e.g., windows), num_cpus::get() directly.
#[cfg(not(any( #[cfg(not(any(
target_os = "linux", target_os = "linux",
target_os = "macos", target_vendor = "apple",
target_os = "freebsd", target_os = "freebsd",
target_os = "netbsd" target_os = "netbsd"
)))] )))]

View file

@ -149,7 +149,7 @@ use std::path::Path;
#[cfg(any( #[cfg(any(
target_os = "linux", target_os = "linux",
target_os = "macos", target_vendor = "apple",
target_os = "android", target_os = "android",
target_os = "freebsd" target_os = "freebsd"
))] ))]
@ -165,7 +165,7 @@ use uucore::libc::statvfs as Sstatfs;
#[cfg(any( #[cfg(any(
target_os = "linux", target_os = "linux",
target_os = "macos", target_vendor = "apple",
target_os = "android", target_os = "android",
target_os = "freebsd" target_os = "freebsd"
))] ))]
@ -211,11 +211,11 @@ impl FsMeta for Sstatfs {
fn free_fnodes(&self) -> u64 { fn free_fnodes(&self) -> u64 {
self.f_ffree as u64 self.f_ffree as u64
} }
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "freebsd"))] #[cfg(any(target_os = "linux", target_vendor = "apple", target_os = "freebsd"))]
fn fs_type(&self) -> i64 { fn fs_type(&self) -> i64 {
self.f_type as i64 self.f_type as i64
} }
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "freebsd")))] #[cfg(not(any(target_os = "linux", target_vendor = "apple", target_os = "freebsd")))]
fn fs_type(&self) -> i64 { fn fs_type(&self) -> i64 {
// FIXME: statvfs doesn't have an equivalent, so we need to do something else // FIXME: statvfs doesn't have an equivalent, so we need to do something else
unimplemented!() unimplemented!()
@ -225,12 +225,12 @@ impl FsMeta for Sstatfs {
fn iosize(&self) -> u64 { fn iosize(&self) -> u64 {
self.f_frsize as u64 self.f_frsize as u64
} }
#[cfg(any(target_os = "macos", target_os = "freebsd"))] #[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
fn iosize(&self) -> u64 { fn iosize(&self) -> u64 {
self.f_iosize as u64 self.f_iosize as u64
} }
// XXX: dunno if this is right // XXX: dunno if this is right
#[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "linux")))] #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))]
fn iosize(&self) -> u64 { fn iosize(&self) -> u64 {
self.f_bsize as u64 self.f_bsize as u64
} }
@ -241,13 +241,13 @@ impl FsMeta for Sstatfs {
// //
// Solaris, Irix and POSIX have a system call statvfs(2) that returns a // Solaris, Irix and POSIX have a system call statvfs(2) that returns a
// struct statvfs, containing an unsigned long f_fsid // struct statvfs, containing an unsigned long f_fsid
#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "linux"))] #[cfg(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux"))]
fn fsid(&self) -> u64 { fn fsid(&self) -> u64 {
let f_fsid: &[u32; 2] = let f_fsid: &[u32; 2] =
unsafe { &*(&self.f_fsid as *const uucore::libc::fsid_t as *const [u32; 2]) }; unsafe { &*(&self.f_fsid as *const uucore::libc::fsid_t as *const [u32; 2]) };
(u64::from(f_fsid[0])) << 32 | u64::from(f_fsid[1]) (u64::from(f_fsid[0])) << 32 | u64::from(f_fsid[1])
} }
#[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "linux")))] #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))]
fn fsid(&self) -> u64 { fn fsid(&self) -> u64 {
self.f_fsid as u64 self.f_fsid as u64
} }
@ -256,7 +256,7 @@ impl FsMeta for Sstatfs {
fn namelen(&self) -> u64 { fn namelen(&self) -> u64 {
self.f_namelen as u64 self.f_namelen as u64
} }
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
fn namelen(&self) -> u64 { fn namelen(&self) -> u64 {
1024 1024
} }
@ -265,7 +265,7 @@ impl FsMeta for Sstatfs {
self.f_namemax as u64 self.f_namemax as u64
} }
// XXX: should everything just use statvfs? // XXX: should everything just use statvfs?
#[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "linux")))] #[cfg(not(any(target_vendor = "apple", target_os = "freebsd", target_os = "linux")))]
fn namelen(&self) -> u64 { fn namelen(&self) -> u64 {
self.f_namemax as u64 self.f_namemax as u64
} }

View file

@ -4,12 +4,12 @@ use std::env;
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "windows")))] #[cfg(not(any(target_vendor = "apple", target_os = "windows")))]
mod platform { mod platform {
pub const DYLIB_EXT: &str = ".so"; pub const DYLIB_EXT: &str = ".so";
} }
#[cfg(any(target_os = "macos", target_os = "ios"))] #[cfg(any(target_vendor = "apple"))]
mod platform { mod platform {
pub const DYLIB_EXT: &str = ".dylib"; pub const DYLIB_EXT: &str = ".dylib";
} }

View file

@ -57,7 +57,7 @@ fn preload_strings() -> (&'static str, &'static str) {
("LD_PRELOAD", "so") ("LD_PRELOAD", "so")
} }
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
fn preload_strings() -> (&'static str, &'static str) { fn preload_strings() -> (&'static str, &'static str) {
("DYLD_LIBRARY_PATH", "dylib") ("DYLD_LIBRARY_PATH", "dylib")
} }
@ -67,7 +67,7 @@ fn preload_strings() -> (&'static str, &'static str) {
target_os = "freebsd", target_os = "freebsd",
target_os = "netbsd", target_os = "netbsd",
target_os = "dragonflybsd", target_os = "dragonflybsd",
target_os = "macos" target_vendor = "apple"
)))] )))]
fn preload_strings() -> (&'static str, &'static str) { fn preload_strings() -> (&'static str, &'static str) {
crash!(1, "Command not supported for this operating system!") crash!(1, "Command not supported for this operating system!")

View file

@ -39,7 +39,7 @@ const HOST_OS: &str = "Windows NT";
const HOST_OS: &str = "FreeBSD"; const HOST_OS: &str = "FreeBSD";
#[cfg(target_os = "openbsd")] #[cfg(target_os = "openbsd")]
const HOST_OS: &str = "OpenBSD"; const HOST_OS: &str = "OpenBSD";
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
const HOST_OS: &str = "Darwin"; const HOST_OS: &str = "Darwin";
#[cfg(target_os = "fuchsia")] #[cfg(target_os = "fuchsia")]
const HOST_OS: &str = "Fuchsia"; const HOST_OS: &str = "Fuchsia";

View file

@ -60,12 +60,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
"count", "count",
"all login names and number of users logged on", "all login names and number of users logged on",
); );
#[cfg(any( #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))]
target_os = "macos",
target_os = "ios",
target_os = "linux",
target_os = "android"
))]
opts.optflag("r", "runlevel", "print current runlevel"); opts.optflag("r", "runlevel", "print current runlevel");
opts.optflag("s", "short", "print only name, line, and time (default)"); opts.optflag("s", "short", "print only name, line, and time (default)");
opts.optflag("t", "time", "print last system clock change"); opts.optflag("t", "time", "print last system clock change");
@ -305,12 +300,7 @@ impl Who {
#[allow(unused_assignments)] #[allow(unused_assignments)]
let mut res = false; let mut res = false;
#[cfg(any( #[cfg(any(target_vendor = "apple", target_os = "linux", target_os = "android"))]
target_os = "macos",
target_os = "ios",
target_os = "linux",
target_os = "android"
))]
{ {
res = record == utmpx::RUN_LVL; res = record == utmpx::RUN_LVL;
} }

View file

@ -34,7 +34,7 @@
//! assert!(entries::Group::locate(root_group).is_ok()); //! assert!(entries::Group::locate(root_group).is_ok());
//! ``` //! ```
#[cfg(any(target_os = "freebsd", target_os = "macos"))] #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
use libc::time_t; use libc::time_t;
use libc::{c_char, c_int, gid_t, uid_t}; use libc::{c_char, c_int, gid_t, uid_t};
use libc::{getgrgid, getgrnam, getgroups, getpwnam, getpwuid, group, passwd}; use libc::{getgrgid, getgrnam, getgroups, getpwnam, getpwuid, group, passwd};
@ -119,19 +119,19 @@ impl Passwd {
} }
/// AKA passwd.pw_class /// AKA passwd.pw_class
#[cfg(any(target_os = "freebsd", target_os = "macos"))] #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
pub fn user_access_class(&self) -> Cow<str> { pub fn user_access_class(&self) -> Cow<str> {
cstr2cow!(self.inner.pw_class) cstr2cow!(self.inner.pw_class)
} }
/// AKA passwd.pw_change /// AKA passwd.pw_change
#[cfg(any(target_os = "freebsd", target_os = "macos"))] #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
pub fn passwd_change_time(&self) -> time_t { pub fn passwd_change_time(&self) -> time_t {
self.inner.pw_change self.inner.pw_change
} }
/// AKA passwd.pw_expire /// AKA passwd.pw_expire
#[cfg(any(target_os = "freebsd", target_os = "macos"))] #[cfg(any(target_os = "freebsd", target_vendor = "apple"))]
pub fn expiration(&self) -> time_t { pub fn expiration(&self) -> time_t {
self.inner.pw_expire self.inner.pw_expire
} }

View file

@ -197,7 +197,7 @@ No Name Default Action Description
*/ */
#[cfg(any(target_os = "macos", target_os = "freebsd"))] #[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
pub static ALL_SIGNALS: [Signal<'static>; 31] = [ pub static ALL_SIGNALS: [Signal<'static>; 31] = [
Signal { Signal {
name: "HUP", name: "HUP",

View file

@ -47,7 +47,7 @@ use libc::utmpx;
pub use libc::endutxent; pub use libc::endutxent;
pub use libc::getutxent; pub use libc::getutxent;
pub use libc::setutxent; pub use libc::setutxent;
#[cfg(any(target_os = "macos", target_os = "linux"))] #[cfg(any(target_vendor = "apple", target_os = "linux"))]
pub use libc::utmpxname; pub use libc::utmpxname;
#[cfg(target_os = "freebsd")] #[cfg(target_os = "freebsd")]
pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int { pub unsafe extern "C" fn utmpxname(_file: *const libc::c_char) -> libc::c_int {
@ -85,7 +85,7 @@ mod ut {
pub use libc::USER_PROCESS; pub use libc::USER_PROCESS;
} }
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
mod ut { mod ut {
pub static DEFAULT_FILE: &str = "/var/run/utmpx"; pub static DEFAULT_FILE: &str = "/var/run/utmpx";

View file

@ -115,7 +115,7 @@ fn test_reference() {
} }
#[test] #[test]
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
fn test_reference() { fn test_reference() {
new_ucmd!() new_ucmd!()
.arg("-v") .arg("-v")

View file

@ -12,7 +12,7 @@ fn test_du_basics() {
assert!(result.success); assert!(result.success);
assert_eq!(result.stderr, ""); assert_eq!(result.stderr, "");
} }
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
fn _du_basics(s: String) { fn _du_basics(s: String) {
let answer = "32\t./subdir let answer = "32\t./subdir
8\t./subdir/deeper 8\t./subdir/deeper
@ -21,7 +21,7 @@ fn _du_basics(s: String) {
"; ";
assert_eq!(s, answer); assert_eq!(s, answer);
} }
#[cfg(not(target_os = "macos"))] #[cfg(not(target_vendor = "apple"))]
fn _du_basics(s: String) { fn _du_basics(s: String) {
let answer = "28\t./subdir let answer = "28\t./subdir
8\t./subdir/deeper 8\t./subdir/deeper
@ -41,11 +41,11 @@ fn test_du_basics_subdir() {
_du_basics_subdir(result.stdout); _du_basics_subdir(result.stdout);
} }
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
fn _du_basics_subdir(s: String) { fn _du_basics_subdir(s: String) {
assert_eq!(s, "4\tsubdir/deeper\n"); assert_eq!(s, "4\tsubdir/deeper\n");
} }
#[cfg(not(target_os = "macos"))] #[cfg(not(target_vendor = "apple"))]
fn _du_basics_subdir(s: String) { fn _du_basics_subdir(s: String) {
// MS-WSL linux has altered expected output // MS-WSL linux has altered expected output
if !is_wsl() { if !is_wsl() {
@ -80,12 +80,12 @@ fn test_du_soft_link() {
_du_soft_link(result.stdout); _du_soft_link(result.stdout);
} }
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
fn _du_soft_link(s: String) { fn _du_soft_link(s: String) {
// 'macos' host variants may have `du` output variation for soft links // 'macos' host variants may have `du` output variation for soft links
assert!((s == "12\tsubdir/links\n") || (s == "16\tsubdir/links\n")); assert!((s == "12\tsubdir/links\n") || (s == "16\tsubdir/links\n"));
} }
#[cfg(not(target_os = "macos"))] #[cfg(not(target_vendor = "apple"))]
fn _du_soft_link(s: String) { fn _du_soft_link(s: String) {
// MS-WSL linux has altered expected output // MS-WSL linux has altered expected output
if !is_wsl() { if !is_wsl() {
@ -109,11 +109,11 @@ fn test_du_hard_link() {
_du_hard_link(result.stdout); _du_hard_link(result.stdout);
} }
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
fn _du_hard_link(s: String) { fn _du_hard_link(s: String) {
assert_eq!(s, "12\tsubdir/links\n") assert_eq!(s, "12\tsubdir/links\n")
} }
#[cfg(not(target_os = "macos"))] #[cfg(not(target_vendor = "apple"))]
fn _du_hard_link(s: String) { fn _du_hard_link(s: String) {
// MS-WSL linux has altered expected output // MS-WSL linux has altered expected output
if !is_wsl() { if !is_wsl() {
@ -133,11 +133,11 @@ fn test_du_d_flag() {
_du_d_flag(result.stdout); _du_d_flag(result.stdout);
} }
#[cfg(target_os = "macos")] #[cfg(target_vendor = "apple")]
fn _du_d_flag(s: String) { fn _du_d_flag(s: String) {
assert_eq!(s, "16\t./subdir\n20\t./\n"); assert_eq!(s, "16\t./subdir\n20\t./\n");
} }
#[cfg(not(target_os = "macos"))] #[cfg(not(target_vendor = "apple"))]
fn _du_d_flag(s: String) { fn _du_d_flag(s: String) {
// MS-WSL linux has altered expected output // MS-WSL linux has altered expected output
if !is_wsl() { if !is_wsl() {

View file

@ -11,7 +11,7 @@ fn test_hostname() {
} }
// FixME: fails for "MacOS" // FixME: fails for "MacOS"
#[cfg(not(target_os = "macos"))] #[cfg(not(target_vendor = "apple"))]
#[test] #[test]
fn test_hostname_ip() { fn test_hostname_ip() {
let result = new_ucmd!().arg("-i").run(); let result = new_ucmd!().arg("-i").run();

View file

@ -285,7 +285,7 @@ fn test_ls_ls_color() {
scene.ucmd().arg("--color=never").arg("z").succeeds(); scene.ucmd().arg("--color=never").arg("z").succeeds();
} }
#[cfg(not(any(target_os = "macos", target_os = "windows")))] // Truncate not available on mac or win #[cfg(not(any(target_vendor = "apple", target_os = "windows")))] // Truncate not available on mac or win
#[test] #[test]
fn test_ls_human() { fn test_ls_human() {
let scene = TestScenario::new(util_name!()); let scene = TestScenario::new(util_name!());