Use constants from libc instead of magic numbers.
This commit is contained in:
parent
234af89ffb
commit
4fafb44f89
|
@ -5,13 +5,13 @@ use super::{cvt, Termios};
|
|||
pub fn get_terminal_attr() -> io::Result<Termios> {
|
||||
unsafe {
|
||||
let mut termios = mem::zeroed();
|
||||
cvt(libc::tcgetattr(1, &mut termios))?;
|
||||
cvt(libc::tcgetattr(libc::STDOUT_FILENO, &mut termios))?;
|
||||
Ok(termios)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_terminal_attr(termios: &Termios) -> io::Result<()> {
|
||||
cvt(unsafe { libc::tcsetattr(1, 0, termios) }).and(Ok(()))
|
||||
cvt(unsafe { libc::tcsetattr(libc::STDOUT_FILENO, libc::TCSANOW, termios) }).and(Ok(()))
|
||||
}
|
||||
|
||||
pub fn raw_terminal_attr(termios: &mut Termios) {
|
||||
|
|
Loading…
Reference in New Issue