mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Add strxfrm(3).
This commit is contained in:
parent
0c54bcd6e9
commit
e08c13b344
3 changed files with 34 additions and 1 deletions
|
@ -120,6 +120,7 @@ strspn.o \
|
|||
strstr.o \
|
||||
strtok.o \
|
||||
strtok_r.o \
|
||||
strxfrm.o \
|
||||
ungetc.o \
|
||||
vfscanf.o \
|
||||
vsscanf.o \
|
||||
|
|
|
@ -61,6 +61,7 @@ size_t strspn(const char*, const char*);
|
|||
char* strstr(const char*, const char*);
|
||||
char* strtok(char* restrict, const char* restrict);
|
||||
char* strtok_r(char* restrict, const char* restrict, char** restrict);
|
||||
size_t strxfrm(char* restrict, const char* restrict, size_t);
|
||||
|
||||
/* TODO: These are not implemented in sortix libc yet. */
|
||||
#if defined(__SORTIX_SHOW_UNIMPLEMENTED)
|
||||
|
@ -68,7 +69,6 @@ int strcoll_l(const char*, const char*, locale_t);
|
|||
char* strerror_l(int, locale_t);
|
||||
int strerror_r(int, char*, size_t);
|
||||
char* strsignal(int);
|
||||
size_t strxfrm(char* restrict, const char* restrict, size_t);
|
||||
size_t strxfrm_l(char* restrict, const char* restrict, size_t, locale_t);
|
||||
#endif
|
||||
|
||||
|
|
32
libc/strxfrm.cpp
Normal file
32
libc/strxfrm.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
strxfrm.cpp
|
||||
Transform a string such that the result of strcmp is the same as strcoll.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
extern "C" size_t strxfrm(char* dest, const char* src, size_t n)
|
||||
{
|
||||
size_t srclen = strlen(src);
|
||||
strncpy(dest, src, n);
|
||||
return srclen;
|
||||
}
|
Loading…
Add table
Reference in a new issue