Skip to content
Snippets Groups Projects
Commit fe02a5bd authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Merge branch 'tcsetwinsize' into 'master'

Adding tcsetwinsize

See merge request redox-os/relibc!404
parents 3023dbb3 a237165b
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,12 @@ pub struct winsize { ...@@ -21,6 +21,12 @@ pub struct winsize {
ws_ypixel: c_ushort, ws_ypixel: c_ushort,
} }
impl winsize {
pub fn get_row_col(&self) -> (c_ushort, c_ushort) {
(self.ws_row, self.ws_col)
}
}
pub use self::sys::*; pub use self::sys::*;
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
......
//! termios implementation, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/termios.h.html //! termios implementation, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/termios.h.html
use crate::{ use crate::{
header::{errno, sys_ioctl}, header::{
errno,
sys_ioctl::{self, winsize},
},
platform::{self, types::*}, platform::{self, types::*},
}; };
...@@ -171,6 +174,11 @@ pub unsafe extern "C" fn tcsendbreak(fd: c_int, _dur: c_int) -> c_int { ...@@ -171,6 +174,11 @@ pub unsafe extern "C" fn tcsendbreak(fd: c_int, _dur: c_int) -> c_int {
sys_ioctl::ioctl(fd, sys_ioctl::TCSBRK, 0 as *mut _) sys_ioctl::ioctl(fd, sys_ioctl::TCSBRK, 0 as *mut _)
} }
#[no_mangle]
pub unsafe extern "C" fn tcsetwinsize(fd: c_int, mut sws: winsize) -> c_int {
sys_ioctl::ioctl(fd, sys_ioctl::TIOCSWINSZ, &mut sws as *mut _ as *mut c_void)
}
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn tcflow(fd: c_int, action: c_int) -> c_int { pub unsafe extern "C" fn tcflow(fd: c_int, action: c_int) -> c_int {
// non-zero duration is ignored by musl due to it being // non-zero duration is ignored by musl due to it being
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment