From 878208485c7c1e9eaa7c55f7f1c47c527bb51d5d Mon Sep 17 00:00:00 2001
From: jD91mZM2 <me@krake.one>
Date: Tue, 17 Jul 2018 17:44:38 +0200
Subject: [PATCH] strcoll as strcmp because no locale

---
 src/string/src/lib.rs    | 16 +++++++++++-----
 src/time/src/strftime.rs |  2 +-
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/string/src/lib.rs b/src/string/src/lib.rs
index d04730a7..33e6e134 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 8a7d78c8..47600740 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);
         }
-- 
GitLab