Skip to content

Commit c9fe2e5

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 1fdbdc7 commit c9fe2e5

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
@@ -658,12 +658,9 @@ fn print_terminal_size(
658658
);
659659
}
660660

661-
#[cfg(any(target_os = "linux", target_os = "redox"))]
661+
#[cfg(any(target_os = "linux", target_os = "android", target_os = "haiku"))]
662662
{
663-
// For some reason the normal nix Termios struct does not expose the line,
664-
// so we get the underlying libc::termios struct to get that information.
665-
let libc_termios: nix::libc::termios = termios.clone().into();
666-
let line = libc_termios.c_line;
663+
let line = termios.line_discipline;
667664
printer.print(&translate!("stty-output-line", "line" => line));
668665
}
669666
printer.flush();
@@ -1042,7 +1039,7 @@ fn apply_special_setting(
10421039
)]
10431040
SpecialSetting::Line(n) => {
10441041
// nix only defines Termios's `line_discipline` field on these platforms
1045-
#[cfg(any(target_os = "linux", target_os = "android"))]
1042+
#[cfg(any(target_os = "linux", target_os = "android", target_os = "haiku"))]
10461043
{
10471044
_termios.line_discipline = *n;
10481045
}

0 commit comments

Comments
 (0)