From 398e31fa3789f0574a6ff679742dfb7639984e12 Mon Sep 17 00:00:00 2001 From: johalun Date: Thu, 12 Jan 2017 13:16:09 -0800 Subject: Make it run on FreeBSD --- src/config.rs | 3 +-- src/tty.rs | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/config.rs b/src/config.rs index 2665c3b3..e9173f6c 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1100,7 +1100,7 @@ impl Default for Font { } } -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux",target_os = "freebsd"))] impl Default for Font { fn default() -> Font { Font { @@ -1546,4 +1546,3 @@ impl Key { } } } - diff --git a/src/tty.rs b/src/tty.rs index c9feae36..0f885d52 100644 --- a/src/tty.rs +++ b/src/tty.rs @@ -20,7 +20,7 @@ use std::fs::File; use std::os::unix::io::FromRawFd; use std::ptr; -use libc::{self, winsize, c_int, pid_t, WNOHANG, WIFEXITED, WEXITSTATUS, SIGCHLD}; +use libc::{self, winsize, c_int, pid_t, WNOHANG, WIFEXITED, WEXITSTATUS, SIGCHLD, TIOCSCTTY}; use term::SizeInfo; use display::OnResize; @@ -112,7 +112,7 @@ fn openpty(rows: u8, cols: u8) -> (c_int, c_int) { (master, slave) } -#[cfg(target_os = "macos")] +#[cfg(any(target_os = "macos",target_os = "freebsd"))] fn openpty(rows: u8, cols: u8) -> (c_int, c_int) { let mut master: c_int = 0; let mut slave: c_int = 0; @@ -138,7 +138,7 @@ fn openpty(rows: u8, cols: u8) -> (c_int, c_int) { /// Really only needed on BSD, but should be fine elsewhere fn set_controlling_terminal(fd: c_int) { let res = unsafe { - libc::ioctl(fd, libc::TIOCSCTTY as _, 0) + libc::ioctl(fd, TIOCSCTTY as _, 0) }; if res < 0 { -- cgit