Skip to content

Commit 1a8327b

Browse files
committed
stty: Use c_line (as line_discipline) from nix
Nix now supports the line discipline parameter in various platforms, so use upstream definition instead of going through libc See: nix-rust/nix#1802
1 parent f27ad13 commit 1a8327b

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/uu/stty/src/stty.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -688,12 +688,9 @@ fn print_terminal_size(
688688
);
689689
}
690690

691-
#[cfg(any(target_os = "linux", target_os = "redox"))]
691+
#[cfg(any(target_os = "linux", target_os = "android", target_os = "haiku"))]
692692
{
693-
// For some reason the normal nix Termios struct does not expose the line,
694-
// so we get the underlying libc::termios struct to get that information.
695-
let libc_termios: nix::libc::termios = termios.clone().into();
696-
let line = libc_termios.c_line;
693+
let line = termios.line_discipline;
697694
printer.print(&translate!("stty-output-line", "line" => line));
698695
}
699696
printer.flush();
@@ -1056,7 +1053,7 @@ fn apply_special_setting(
10561053
)]
10571054
SpecialSetting::Line(n) => {
10581055
// nix only defines Termios's `line_discipline` field on these platforms
1059-
#[cfg(any(target_os = "linux", target_os = "android"))]
1056+
#[cfg(any(target_os = "linux", target_os = "android", target_os = "haiku"))]
10601057
{
10611058
_termios.line_discipline = *n;
10621059
}

0 commit comments

Comments
 (0)