summaryrefslogtreecommitdiff
path: root/lib/libc/string
diff options
context:
space:
mode:
authorjoerg <joerg@NetBSD.org>2013-04-19 23:28:47 +0000
committerjoerg <joerg@NetBSD.org>2013-04-19 23:28:47 +0000
commitbd02ea9984d47ffcd53008b81e69b5f39dde4809 (patch)
treecfc608bc07bdd0d76e030932aaf1121e94732cd2 /lib/libc/string
parent1dac79f3bd80a6f3f4e6813f54748c7c2037b235 (diff)
Add dummy strcoll_l and strxfrm_l.
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/strcoll.c20
-rw-r--r--lib/libc/string/strxfrm.c23
2 files changed, 38 insertions, 5 deletions
diff --git a/lib/libc/string/strcoll.c b/lib/libc/string/strcoll.c
index 77a09425042..d5da4c8750f 100644
--- a/lib/libc/string/strcoll.c
+++ b/lib/libc/string/strcoll.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strcoll.c,v 1.10 2012/06/25 22:32:46 abs Exp $ */
+/* $NetBSD: strcoll.c,v 1.11 2013/04/19 23:28:47 joerg Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,12 +37,18 @@
#if 0
static char sccsid[] = "@(#)strcoll.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: strcoll.c,v 1.10 2012/06/25 22:32:46 abs Exp $");
+__RCSID("$NetBSD: strcoll.c,v 1.11 2013/04/19 23:28:47 joerg Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
+#include "namespace.h"
+
#include <assert.h>
+#include <locale.h>
#include <string.h>
+#include "setlocale_local.h"
+
+__weak_alias(strcoll_l, _strcoll_l)
/*
* Compare strings according to LC_COLLATE category of current locale.
@@ -51,9 +57,19 @@ int
strcoll(const char *s1, const char *s2)
{
+ return strcoll_l(s1, s2, *_current_locale());
+}
+
+int
+strcoll_l(const char *s1, const char *s2, locale_t loc)
+{
_DIAGASSERT(s1 != NULL);
_DIAGASSERT(s2 != NULL);
+ if (loc == NULL)
+ loc = _C_locale;
+
/* LC_COLLATE is unimplemented, hence always "C" */
+ /* LINTED */ (void)loc;
return (strcmp(s1, s2));
}
diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c
index 42c2a244b90..841c9fceda9 100644
--- a/lib/libc/string/strxfrm.c
+++ b/lib/libc/string/strxfrm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strxfrm.c,v 1.12 2012/06/25 22:32:46 abs Exp $ */
+/* $NetBSD: strxfrm.c,v 1.13 2013/04/19 23:28:47 joerg Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,12 +37,18 @@
#if 0
static char sccsid[] = "@(#)strxfrm.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: strxfrm.c,v 1.12 2012/06/25 22:32:46 abs Exp $");
+__RCSID("$NetBSD: strxfrm.c,v 1.13 2013/04/19 23:28:47 joerg Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
+#include "namespace.h"
+
#include <assert.h>
+#include <locale.h>
#include <string.h>
+#include "setlocale_local.h"
+
+__weak_alias(strxfrm_l, _strxfrm_l)
/*
* Transform src, storing the result in dst, such that
@@ -50,12 +56,17 @@ __RCSID("$NetBSD: strxfrm.c,v 1.12 2012/06/25 22:32:46 abs Exp $");
* on the original untransformed strings would return.
*/
size_t
-strxfrm(char *dst, const char *src, size_t n)
+strxfrm_l(char *dst, const char *src, size_t n, locale_t loc)
{
size_t srclen, copysize;
_DIAGASSERT(src != NULL);
+ if (loc == NULL)
+ loc = _C_locale;
+ /* XXX: LC_COLLATE should be implemented. */
+ /* LINTED */(void)loc;
+
/*
* Since locales are unimplemented, this is just a copy.
*/
@@ -68,3 +79,9 @@ strxfrm(char *dst, const char *src, size_t n)
}
return (srclen);
}
+
+size_t
+strxfrm(char *dst, const char *src, size_t n)
+{
+ return strxfrm_l(dst, src, n, *_current_locale());
+}