diff --git a/src/string/src/lib.rs b/src/string/src/lib.rs index d04730a7160f6b632d70d8732c3b6fc69d0342b5..33e6e1344090733a09c5407b4cc6e089c3a2d58f 100644 --- a/src/string/src/lib.rs +++ b/src/string/src/lib.rs @@ -143,8 +143,9 @@ pub unsafe extern "C" fn strcmp(s1: *const c_char, s2: *const c_char) -> c_int { } // #[no_mangle] -pub extern "C" fn strcoll(s1: *const c_char, s2: *const c_char) -> c_int { - unimplemented!(); +pub unsafe extern "C" fn strcoll(s1: *const c_char, s2: *const c_char) -> c_int { + // relibc has no locale stuff (yet) + strcmp(s1, s2) } #[no_mangle] @@ -400,7 +401,12 @@ pub extern "C" fn strtok_r( } } -// #[no_mangle] -pub extern "C" fn strxfrm(s1: *mut c_char, s2: *const c_char, n: usize) -> size_t { - unimplemented!(); +#[no_mangle] +pub unsafe extern "C" fn strxfrm(s1: *mut c_char, s2: *const c_char, n: usize) -> size_t { + // relibc has no locale stuff (yet) + let len = strlen(s2); + if len < n { + strcpy(s1, s2); + } + len } diff --git a/src/time/src/strftime.rs b/src/time/src/strftime.rs index 8a7d78c83403159db7453e701b489801ca0b67de..47600740ea4d0afdcd1851094da734061e252d4d 100644 --- a/src/time/src/strftime.rs +++ b/src/time/src/strftime.rs @@ -84,7 +84,7 @@ pub unsafe fn strftime<W: Write>( format = format.offset(1); - if *format == b'E' || *format == b'O' { + if *format as u8 == b'E' || *format as u8 == b'O' { // Ignore because these do nothing without locale format = format.offset(1); }