Refine cpio argh

we can use argh to handle `--help` now
This commit is contained in:
LoveSy
2023-07-07 01:06:14 +08:00
committed by John Wu
parent e8e8afa6c2
commit 64c82e1f2c
2 changed files with 30 additions and 28 deletions
+3 -3
View File
@@ -360,12 +360,12 @@ impl<T: AsMut<[u8]>> MutBytesExt for T {
}
}
// SAFETY: libc guarantees argc and argv is properly setup
// SAFETY: libc guarantees argc and argv are properly setup and are static
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub fn map_args<'a>(argc: i32, argv: *const *const c_char) -> Result<Vec<&'a Utf8CStr>, StrErr> {
pub fn map_args(argc: i32, argv: *const *const c_char) -> Result<Vec<&'static str>, StrErr> {
unsafe { slice::from_raw_parts(argv, argc as usize) }
.iter()
.map(|s| unsafe { Utf8CStr::from_ptr(*s) })
.map(|s| unsafe { Utf8CStr::from_ptr(*s) }.map(|s| s.deref()))
.collect()
}