ls, stty: reduce cfg by target_vendor (#11910)

This commit is contained in:
oech3
2026-04-20 08:36:32 +02:00
committed by GitHub
parent ab378e831f
commit ec1fcdb4ac
5 changed files with 38 additions and 65 deletions
+4 -6
View File
@@ -37,15 +37,14 @@ use uucore::entries;
use uucore::fsxattr::has_acl;
#[cfg(any(
target_os = "linux",
target_os = "macos",
target_os = "android",
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos",
target_os = "solaris"
target_os = "solaris",
target_vendor = "apple"
))]
use uucore::libc::{dev_t, major, minor};
use uucore::{
@@ -630,15 +629,14 @@ fn display_date(
fn display_len_or_rdev(metadata: &Metadata, config: &Config) -> SizeOrDeviceId {
#[cfg(any(
target_os = "linux",
target_os = "macos",
target_os = "android",
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos",
target_os = "solaris"
target_os = "solaris",
target_vendor = "apple"
))]
{
let ft = metadata.file_type();
+2 -3
View File
@@ -10,10 +10,9 @@ fn main() {
bsd: { any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
target_os = "openbsd",
target_vendor = "apple"
) },
}
}
+17 -34
View File
@@ -97,137 +97,120 @@ pub const OUTPUT_FLAGS: &[Flag<O>] = &[
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new("ofdel", O::OFDEL),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("nl0", O::NL0, O::NLDLY).sane(),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("nl1", O::NL1, O::NLDLY),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("cr0", O::CR0, O::CRDLY).sane(),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("cr1", O::CR1, O::CRDLY),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("cr2", O::CR2, O::CRDLY),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("cr3", O::CR3, O::CRDLY),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("tab0", O::TAB0, O::TABDLY).sane(),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("tab1", O::TAB1, O::TABDLY),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("tab2", O::TAB2, O::TABDLY),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("tab3", O::TAB3, O::TABDLY),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("bs0", O::BS0, O::BSDLY).sane(),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("bs1", O::BS1, O::BSDLY),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("vt0", O::VT0, O::VTDLY).sane(),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("vt1", O::VT1, O::VTDLY),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("ff0", O::FF0, O::FFDLY).sane(),
#[cfg(any(
target_os = "android",
target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos"
target_vendor = "apple"
))]
Flag::new_grouped("ff1", O::FF1, O::FFDLY),
];
+3 -4
View File
@@ -478,7 +478,7 @@ fn test_ls_devices() {
at.mkdir("some-dir1");
// Regex tests correct device ID and correct (no pad) spacing for a single file
#[cfg(any(target_os = "macos", target_os = "ios"))]
#[cfg(target_vendor = "apple")]
{
scene
.ucmd()
@@ -5056,14 +5056,13 @@ fn test_tabsize_formatting() {
#[cfg(any(
target_os = "linux",
target_os = "macos",
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos",
target_os = "solaris"
target_os = "solaris",
target_vendor = "apple"
))]
#[test]
fn test_device_number() {
+12 -18
View File
@@ -156,10 +156,9 @@ fn invalid_baud_setting() {
#[cfg(not(any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
target_os = "openbsd",
target_vendor = "apple"
)))]
new_ucmd!()
.args(&["100"])
@@ -184,10 +183,9 @@ fn invalid_baud_setting() {
#[cfg(not(any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
target_os = "openbsd",
target_vendor = "apple"
)))]
new_ucmd!()
.args(&["ispeed", "995"])
@@ -197,10 +195,9 @@ fn invalid_baud_setting() {
#[cfg(not(any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
target_os = "openbsd",
target_vendor = "apple"
)))]
new_ucmd!()
.args(&["ospeed", "995"])
@@ -479,10 +476,9 @@ fn baud_rate_validation() {
#[cfg(any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
target_os = "openbsd",
target_vendor = "apple"
))]
{
// BSD accepts numeric baud rates
@@ -1495,10 +1491,9 @@ fn invalid_baud_rate() {
#[cfg(not(any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
target_os = "openbsd",
target_vendor = "apple"
)))]
{
new_ucmd!()
@@ -1661,10 +1656,9 @@ fn test_ispeed_ospeed_valid_speeds() {
not(any(
target_os = "freebsd",
target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
target_os = "openbsd",
target_vendor = "apple"
))
))]
#[ignore = "Issue: #9547"]