summaryrefslogtreecommitdiff
path: root/libc/string/wstring.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-11-08 04:21:58 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-11-08 04:21:58 +0000
commit5dcc4c2e25452b932e3c45bf25cfb89db461bba7 (patch)
tree513e3fb2e31564ac07dd4ffbd976893aa73d74f5 /libc/string/wstring.c
parent4edebd1e22b835ff075719c228b099559c7e346d (diff)
Added some temporary "stubs" for collation.
strcoll is an alias for strcmp. strxfrm is an alias for strlcpy. wcscoll is an alias for wcscmp. wcsxfrm is implemented as a wchar version of strlcpy. Real locale-dependent implementations are coming soon.
Diffstat (limited to 'libc/string/wstring.c')
-rw-r--r--libc/string/wstring.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/libc/string/wstring.c b/libc/string/wstring.c
index ab6bd4169..531b1c9fd 100644
--- a/libc/string/wstring.c
+++ b/libc/string/wstring.c
@@ -627,12 +627,17 @@ int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n)
#ifdef L_strcmp
-#ifndef L_wcscmp
+#ifdef L_wcscmp
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning implement wcscoll and remove weak alias (or enable for C locale only)
+#endif
+weak_alias(wcscmp,wcscoll);
+#else /* L_wcscmp */
#ifdef __UCLIBC_MJN3_ONLY__
#warning implement strcoll and remove weak alias (or enable for C locale only)
#endif
weak_alias(strcmp,strcoll);
-#endif
+#endif /* L_wcscmp */
int Wstrcmp(register const Wchar *s1, register const Wchar *s2)
{
@@ -1918,18 +1923,31 @@ size_t strlcat(register char *__restrict dst,
#endif
/**********************************************************************/
+#ifdef L_wcsxfrm
+#define L_strlcpy
+#define Wstrlcpy wcsxfrm
+#endif
+
#ifdef L_strlcpy
+#ifndef L_wcsxfrm
+#define Wstrlcpy strlcpy
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning implement wcscoll and remove weak alias (or enable for C locale only)
+#endif
+weak_alias(strlcpy,strxfrm);
+#endif
+
/* OpenBSD function:
* Copy at most n-1 chars from src to dst and nul-terminate dst.
* Returns strlen(src), so truncation occurred if the return value is >= n. */
-size_t strlcpy(register char *__restrict dst,
- register const char *__restrict src,
- size_t n)
+size_t Wstrlcpy(register Wchar *__restrict dst,
+ register const Wchar *__restrict src,
+ size_t n)
{
- const char *src0 = src;
- char dummy[1];
+ const Wchar *src0 = src;
+ Wchar dummy[1];
if (!n) {
dst = dummy;