summaryrefslogtreecommitdiff
path: root/src/sys/termios.rs
diff options
context:
space:
mode:
authorTerts Diepraam <terts.diepraam@gmail.com>2022-08-21 00:37:17 +0200
committerTerts Diepraam <terts.diepraam@gmail.com>2022-08-22 06:32:11 +0200
commit810f74abbe2a8a4657b5f784ba11599f21ab984a (patch)
treeff814dbe2dc26c32ac5dfcbf9a85c633054d7cd8 /src/sys/termios.rs
parent2a8b438860ed37d515ed2cf854a9cd7cfaef35d5 (diff)
downloadnix-810f74abbe2a8a4657b5f784ba11599f21ab984a.zip
add line field to Termios struct
Diffstat (limited to 'src/sys/termios.rs')
-rw-r--r--src/sys/termios.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/sys/termios.rs b/src/sys/termios.rs
index c5b27d28..b4bb3d85 100644
--- a/src/sys/termios.rs
+++ b/src/sys/termios.rs
@@ -181,6 +181,15 @@ pub struct Termios {
pub local_flags: LocalFlags,
/// Control characters (see `termios.c_cc` documentation)
pub control_chars: [libc::cc_t; NCCS],
+ /// Line discipline (see `termios.c_line` documentation)
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "android",
+ ))]
+ pub line_discipline: libc::cc_t,
+ /// Line discipline (see `termios.c_line` documentation)
+ #[cfg(target_os = "haiku")]
+ pub line_discipline: libc::c_char,
}
impl Termios {
@@ -196,6 +205,14 @@ impl Termios {
termios.c_cflag = self.control_flags.bits();
termios.c_lflag = self.local_flags.bits();
termios.c_cc = self.control_chars;
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "android",
+ target_os = "haiku",
+ ))]
+ {
+ termios.c_line = self.line_discipline;
+ }
}
self.inner.borrow()
}
@@ -214,6 +231,14 @@ impl Termios {
termios.c_cflag = self.control_flags.bits();
termios.c_lflag = self.local_flags.bits();
termios.c_cc = self.control_chars;
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "android",
+ target_os = "haiku",
+ ))]
+ {
+ termios.c_line = self.line_discipline;
+ }
}
self.inner.as_ptr()
}
@@ -226,6 +251,14 @@ impl Termios {
self.control_flags = ControlFlags::from_bits_truncate(termios.c_cflag);
self.local_flags = LocalFlags::from_bits_truncate(termios.c_lflag);
self.control_chars = termios.c_cc;
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "android",
+ target_os = "haiku",
+ ))]
+ {
+ self.line_discipline = termios.c_line;
+ }
}
}
@@ -238,6 +271,12 @@ impl From<libc::termios> for Termios {
control_flags: ControlFlags::from_bits_truncate(termios.c_cflag),
local_flags: LocalFlags::from_bits_truncate(termios.c_lflag),
control_chars: termios.c_cc,
+ #[cfg(any(
+ target_os = "linux",
+ target_os = "android",
+ target_os = "haiku",
+ ))]
+ line_discipline: termios.c_line,
}
}
}