From 3800f31e9293fcdb005392db8cf2fa60cd4a89f0 Mon Sep 17 00:00:00 2001
From: Ticki <Ticki@users.noreply.github.com>
Date: Thu, 10 Mar 2016 07:05:08 +0100
Subject: [PATCH] Use libc termios struct

---
 src/termios.rs | 30 +++++-------------------------
 1 file changed, 5 insertions(+), 25 deletions(-)

diff --git a/src/termios.rs b/src/termios.rs
index 3b8e9ccb..d387c8ae 100644
--- a/src/termios.rs
+++ b/src/termios.rs
@@ -1,4 +1,7 @@
-use libc::{c_int, c_uint, c_uchar};
+use libc::c_int;
+use std::mem;
+
+pub use libc::termios as Termios;
 
 #[cfg(not(target_os = "macos"))]
 pub const TIOCGWINSZ: usize = 0x00005413;
@@ -12,32 +15,9 @@ extern {
     pub fn cfmakeraw(termptr: *mut Termios);
 }
 
-#[derive(Clone)]
-#[repr(C)]
-pub struct Termios {
-    c_iflag: c_uint,
-    c_oflag: c_uint,
-    c_cflag: c_uint,
-    c_lflag: c_uint,
-    c_line: c_uchar,
-    c_cc: [c_uchar; 32],
-    c_ispeed: c_uint,
-    c_ospeed: c_uint,
-}
-
 pub fn get_terminal_attr() -> (Termios, c_int) {
     unsafe {
-        let mut ios = Termios {
-            c_iflag: 0,
-            c_oflag: 0,
-            c_cflag: 0,
-            c_lflag: 0,
-            c_line: 0,
-            c_cc: [0; 32],
-            c_ispeed: 0,
-            c_ospeed: 0
-        };
-
+        let mut ios = mem::zeroed();
         let attr = tcgetattr(0, &mut ios);
         (ios, attr)
     }
-- 
GitLab