Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 15 additions & 21 deletions src/uu/stty/src/stty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,42 +630,36 @@ fn print_terminal_size(
// GNU linked against glibc 2.42 provides us baudrate 51 which panics cfgetospeed
#[cfg(not(target_os = "linux"))]
let speed = nix::sys::termios::cfgetospeed(termios);
#[cfg(all(
target_os = "linux",
not(target_arch = "powerpc"),
not(target_arch = "powerpc64")
))]
#[cfg(target_os = "linux")]
#[cfg(all(not(target_arch = "powerpc"), not(target_arch = "powerpc64")))]
ioctl_read_bad!(tcgets2, TCGETS2, termios2);
#[cfg(all(
target_os = "linux",
not(target_arch = "powerpc"),
not(target_arch = "powerpc64")
))]
#[cfg(target_os = "linux")]
#[cfg(all(not(target_arch = "powerpc"), not(target_arch = "powerpc64")))]
let speed = {
let mut t2 = unsafe { std::mem::zeroed::<termios2>() };
unsafe { tcgets2(opts.file.as_raw_fd(), &raw mut t2)? };
t2.c_ospeed
};
#[cfg(all(
target_os = "linux",
any(target_arch = "powerpc", target_arch = "powerpc64")
))]
#[cfg(target_os = "linux")]
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
let speed = nix::sys::termios::cfgetospeed(termios);

let mut printer = WrappedPrinter::new(window_size);

// BSDs and Linux (non-PowerPC) use a u32 for the baud rate, so we can simply print it.
// BSDs and Linux (not ppc/big-endian ppc64) use a u32 for the baud rate, so we can simply
// print it.
#[cfg(any(target_os = "linux", bsd))]
#[cfg(all(
any(target_os = "linux", bsd),
not(target_arch = "powerpc"),
not(target_arch = "powerpc64")
not(all(target_arch = "powerpc64", target_endian = "big"))
))]
printer.print(&translate!("stty-output-speed", "speed" => speed));

// PowerPC uses BaudRate enum, need to convert to display format
#[cfg(all(
target_os = "linux",
any(target_arch = "powerpc", target_arch = "powerpc64")
// Big-endian Linux PowerPC uses BaudRate enum, need to convert to display format
#[cfg(target_os = "linux")]
#[cfg(any(
target_arch = "powerpc",
all(target_arch = "powerpc64", target_endian = "big")
))]
{
// On PowerPC, find the corresponding baud rate string for display
Expand Down
Loading