diff --git a/src/uu/stdbuf/build.rs b/src/uu/stdbuf/build.rs index 66f702c4597..aa2692cb512 100644 --- a/src/uu/stdbuf/build.rs +++ b/src/uu/stdbuf/build.rs @@ -14,6 +14,7 @@ use std::process::Command; target_os = "android", target_os = "freebsd", target_os = "netbsd", + target_os = "openbsd", target_os = "dragonfly" ))] mod platform { diff --git a/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs b/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs index d99509880b7..3ef7473bf79 100644 --- a/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs +++ b/src/uu/stdbuf/src/libstdbuf/src/libstdbuf.rs @@ -27,7 +27,15 @@ pub unsafe extern "C" fn __stdbuf_get_stdin() -> *mut FILE { unsafe { __stdinp() } } - #[cfg(not(any(target_os = "macos", target_os = "freebsd")))] + #[cfg(target_os = "openbsd")] + { + unsafe extern "C" { + static mut __stdin: *mut FILE; + } + unsafe { __stdin } + } + + #[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd")))] { unsafe extern "C" { static mut stdin: *mut FILE; @@ -48,7 +56,15 @@ pub unsafe extern "C" fn __stdbuf_get_stdout() -> *mut FILE { unsafe { __stdoutp() } } - #[cfg(not(any(target_os = "macos", target_os = "freebsd")))] + #[cfg(target_os = "openbsd")] + { + unsafe extern "C" { + static mut __stdout: *mut FILE; + } + unsafe { __stdout } + } + + #[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd")))] { unsafe extern "C" { static mut stdout: *mut FILE; @@ -69,7 +85,15 @@ pub unsafe extern "C" fn __stdbuf_get_stderr() -> *mut FILE { unsafe { __stderrp() } } - #[cfg(not(any(target_os = "macos", target_os = "freebsd")))] + #[cfg(target_os = "openbsd")] + { + unsafe extern "C" { + static mut __stderr: *mut FILE; + } + unsafe { __stderr } + } + + #[cfg(not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd")))] { unsafe extern "C" { static mut stderr: *mut FILE; diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 639c3ffff07..52824ad5e61 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -35,6 +35,7 @@ mod options { target_os = "android", target_os = "freebsd", target_os = "netbsd", + target_os = "openbsd", target_os = "dragonfly" ) ))] @@ -82,6 +83,7 @@ enum ProgramOptionsError { target_os = "android", target_os = "freebsd", target_os = "netbsd", + target_os = "openbsd", target_os = "dragonfly" ))] fn preload_strings() -> UResult<(&'static str, &'static str)> { @@ -98,6 +100,7 @@ fn preload_strings() -> UResult<(&'static str, &'static str)> { target_os = "android", target_os = "freebsd", target_os = "netbsd", + target_os = "openbsd", target_os = "dragonfly", target_vendor = "apple" )))]