1#![doc = include_str!("../README.md")]
2#![feature(sync_unsafe_cell)]
3#![cfg_attr(not(feature = "std"), no_std)]
4#![allow(unreachable_patterns)]
6#![allow(irrefutable_let_patterns)]
8
9#[cfg(feature = "std")]
10extern crate alloc;
11#[allow(unused_extern_crates)]
12extern crate c_scape;
13
14pub use c_scape::*;
17
18#[macro_use]
19mod use_libc;
20
21#[cfg(feature = "std")]
22mod nss;
23#[cfg(feature = "std")]
24mod resolve;
25#[cfg(feature = "std")]
26mod sysconf;
27#[cfg(feature = "std")]
28mod system;
29#[cfg(feature = "std")]
30mod termios_;
31#[cfg(feature = "std")]
32mod time;
33#[cfg(feature = "std")]
34#[cfg(not(target_env = "musl"))]
35mod utmp;
36
37#[cfg(feature = "std")]
38#[cold]
39#[no_mangle]
40unsafe extern "C" fn __assert_fail(
41 expr: *const c_char,
42 file: *const c_char,
43 line: c_int,
44 func: *const c_char,
45) -> ! {
46 use std::ffi::CStr;
47 eprintln!(
50 "Assertion failed: {:?} ({:?}:{}: {:?})",
51 CStr::from_ptr(expr),
52 CStr::from_ptr(file),
53 line,
54 CStr::from_ptr(func)
55 );
56 std::process::abort();
57}
58
59#[cfg(feature = "std")]
64fn convert_res<T>(result: Result<T, rustix::io::Errno>) -> Option<T> {
65 use errno::{set_errno, Errno};
66 result
67 .map_err(|err| set_errno(Errno(err.raw_os_error())))
68 .ok()
69}