diff --git a/libc/Makefile b/libc/Makefile index ba49b95f..9e9081dd 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -132,6 +132,7 @@ string/strstr.o \ string/strtok.o \ string/strtok_r.o \ string/strverscmp.o \ +string/strxfrm_l.o \ string/strxfrm.o \ time/asctime.o \ time/asctime_r.o \ diff --git a/libc/include/string.h b/libc/include/string.h index 46b8308b..b8ad345d 100644 --- a/libc/include/string.h +++ b/libc/include/string.h @@ -64,12 +64,12 @@ char* strtok(char* __restrict, const char* __restrict); char* strtok_r(char* __restrict, const char* __restrict, char** __restrict); int strverscmp(const char*, const char*); size_t strxfrm(char* __restrict, const char* __restrict, size_t); +size_t strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t); /* TODO: These are not implemented in sortix libc yet. */ #if defined(__SORTIX_SHOW_UNIMPLEMENTED) char* strerror_l(int, locale_t); int strerror_r(int, char*, size_t); -size_t strxfrm_l(char* __restrict, const char* __restrict, size_t, locale_t); #endif #if defined(_SORTIX_SOURCE) || defined(_GNU_SOURCE) diff --git a/libc/string/strxfrm_l.cpp b/libc/string/strxfrm_l.cpp new file mode 100644 index 00000000..037cef89 --- /dev/null +++ b/libc/string/strxfrm_l.cpp @@ -0,0 +1,31 @@ +/******************************************************************************* + + Copyright(C) Jonas 'Sortie' Termansen 2013. + + This file is part of the Sortix C Library. + + The Sortix C Library is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + The Sortix C Library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with the Sortix C Library. If not, see . + + string/strxfrm_l.cpp + Transform a string such that the result of strcmp is the same as strcoll_l. + +*******************************************************************************/ + +#include + +extern "C" +size_t strxfrm_l(char* dest, const char* src, size_t n, locale_t /*locale*/) +{ + return strxfrm(dest, src, n); +}