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