Skip to content

Commit

Permalink
fix freebsd erros ref #115
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Jul 3, 2023
1 parent 085891f commit 4636f43
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.0.9 (in progress)

- FreeBSD support.

## 0.0.8

- Added generation of `.msi` and `.exe` files to the release pipeline (stable and canary).
Expand Down
13 changes: 8 additions & 5 deletions teletypewriter/src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ pub fn terminfo_exists(terminfo: &str) -> bool {
}

pub fn create_termp(utf8: bool) -> libc::termios {
#[cfg(not(target_os = "macos"))]
#[cfg(target_os = "linux")]
let mut term = libc::termios {
c_iflag: libc::ICRNL | libc::IXON | libc::IXANY | libc::IMAXBEL | libc::BRKINT,
c_oflag: libc::OPOST | libc::ONLCR,
Expand All @@ -265,7 +265,7 @@ pub fn create_termp(utf8: bool) -> libc::termios {
c_line: 0,
};

#[cfg(target_os = "macos")]
#[cfg(any(target_os = "macos", target_os = "freebsd"))]
let mut term = libc::termios {
c_iflag: libc::ICRNL | libc::IXON | libc::IXANY | libc::IMAXBEL | libc::BRKINT,
c_oflag: libc::OPOST | libc::ONLCR,
Expand All @@ -283,9 +283,12 @@ pub fn create_termp(utf8: bool) -> libc::termios {
c_ospeed: Default::default(),
};

// Enable utf8 support if requested
if utf8 {
term.c_iflag |= libc::IUTF8;
#[cfg(not(target_os = "freebsd"))]
{
// Enable utf8 support if requested
if utf8 {
term.c_iflag |= libc::IUTF8;
}
}

// Set supported terminal characters
Expand Down

0 comments on commit 4636f43

Please sign in to comment.