strcoll as strcmp because no locale

This commit is contained in:
jD91mZM2
2018-07-17 17:44:38 +02:00
parent 482bd9c5f1
commit 878208485c
2 changed files with 12 additions and 6 deletions
+11 -5
View File
@@ -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
}