1mod fd;
2
3pub use fd::Fd;
4
5pub fn c_string_to_str(s: &[libc::c_char]) -> &str {
6 let pos = s.iter().position(|c| *c == 0).unwrap_or(s.len());
7 let s = unsafe { core::slice::from_raw_parts(s.as_ptr() as * const _, pos) };
8
9 core::str::from_utf8(s).unwrap()
10}