Skip to content

Commit f0de189

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 fa39e80 commit f0de189

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/uu/stty/src/stty.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -589,12 +589,9 @@ fn print_terminal_size(
589589
);
590590
}
591591

592-
#[cfg(any(target_os = "linux", target_os = "redox"))]
592+
#[cfg(any(target_os = "linux", target_os = "android", target_os = "haiku"))]
593593
{
594-
// For some reason the normal nix Termios struct does not expose the line,
595-
// so we get the underlying libc::termios struct to get that information.
596-
let libc_termios: nix::libc::termios = termios.clone().into();
597-
let line = libc_termios.c_line;
594+
let line = termios.line_discipline;
598595
printer.print(&translate!("stty-output-line", "line" => line));
599596
}
600597
printer.flush();
@@ -888,7 +885,7 @@ fn apply_special_setting(
888885
SpecialSetting::Cols(n) => size.columns = *n,
889886
SpecialSetting::Line(_n) => {
890887
// nix only defines Termios's `line_discipline` field on these platforms
891-
#[cfg(any(target_os = "linux", target_os = "android"))]
888+
#[cfg(any(target_os = "linux", target_os = "android", target_os = "haiku"))]
892889
{
893890
_termios.line_discipline = *_n;
894891
}

0 commit comments

Comments
 (0)