summaryrefslogtreecommitdiff
path: root/lib/libc/string
diff options
context:
space:
mode:
authortnozaki <tnozaki@NetBSD.org>2009-01-02 00:20:18 +0000
committertnozaki <tnozaki@NetBSD.org>2009-01-02 00:20:18 +0000
commit52ed7b035ff6e5fc73eada9c5ce08f7fa154eb8c (patch)
tree9f1f04551051a7947bc39a09f744c2530039cbf3 /lib/libc/string
parent2577e51e90a539fb95d67e7acc4c3a378da404d8 (diff)
Fixes PR lib/39662, shortcomings in LC_{MONETARY,NUMERIC,TIME,MESSAGES} db format.
ok'ed by core and releng. (thanks for agc@, snj@ and i'm sorry for long time patience). [libc] - localeio.[ch] and lc*.[ch] in src/lib/libc/locale was replaced by new locale-db implementation using citrus_db backend, see src/lib/libc/citrus/citrus_lc_*.[ch]. - add citrus_bcs_strtou?l.c. don't use strtou?l locale implementation internally, because they're locale-aware function. - add some stubs for multi-locale issue, see {current,global}_locale.c. - remove some obsolete file, setrunelocale.c, ___runetype_mb.c. - remove __savectype() from ctypeio.[ch]. [tools] - mklocale(1): add new option ``-t'' that generates new style LC_{MONETARY,NUMERIC,TIME,MESSAGES} locale-db format. - chrtbl(1): added ctypeio.[ch] for __savectype(). [locale-db] - added en_US.US-ASCII locale. - removed some shareable locale definition file: en_US.US-ASCII -> en_US.ISO8859-1, en_US.UTF-8 zh_CN.eucCN -> zh_CN.GB18030 and more...see src/share/locale/*/Makefile. - remove obsoleted locale sr_YU, added new locale sr_ME, sr_RS. - change locale name ja_JP.ISO2022-JP* -> ja_JP.ISO-2022-JP* for X11's locale.alias file alignments. - fix regression test, wrong wcs?width(3), NAN/INF usage. i tested release-build following arch: i386, amd64, hpc{mips,arm,sh}, sparc64, vax. citrus_lc_*.[ch] also can read old-plain-text style locale-db. so that backward compatibility is keeped, but lc*.[ch] can't read new citrus_db'ed locale-db and localeio.c never check sanity, so forward compatibility is broken ;-< old mklocale(1) doesn't know -t option, so you have to rebuild toolchain.
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/Makefile.inc8
-rw-r--r--lib/libc/string/wcscmp.c6
-rw-r--r--lib/libc/string/wcsncmp.c6
-rw-r--r--lib/libc/string/wcswidth.c60
-rw-r--r--lib/libc/string/wmemcmp.c6
5 files changed, 14 insertions, 72 deletions
diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc
index 6ff9fd5effd..c0e92cd2edb 100644
--- a/lib/libc/string/Makefile.inc
+++ b/lib/libc/string/Makefile.inc
@@ -1,5 +1,5 @@
# from: @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $NetBSD: Makefile.inc,v 1.67 2007/02/17 09:32:58 wiz Exp $
+# $NetBSD: Makefile.inc,v 1.68 2009/01/02 00:20:21 tnozaki Exp $
# string sources
.PATH: ${ARCHDIR}/string ${.CURDIR}/string
@@ -13,8 +13,10 @@ SRCS+= bm.c strcasecmp.c strncasecmp.c strcasestr.c strcoll.c strdup.c \
SRCS+= wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c \
wcslen.c wcsncat.c wcscasecmp.c wcsdup.c wcsncasecmp.c \
wcsncmp.c wcsncpy.c wcspbrk.c wcsrchr.c wcsspn.c wcsstr.c wcstok.c \
- wcswcs.c wcswidth.c \
- wmemchr.c wmemcmp.c wmemcpy.c wmemmove.c wmemset.c
+ wcswcs.c wmemchr.c wmemcmp.c wmemcpy.c wmemmove.c wmemset.c
+CPPFLAGS.wcscmp.c+= -I${LIBCDIR}/locale
+CPPFLAGS.wcsncmp.c+= -I${LIBCDIR}/locale
+CPPFLAGS.wmemcmp.c+= -I${LIBCDIR}/locale
# namespace protection wrappers
SRCS+= _strlcat.c _strlcpy.c _strerror_r.c
diff --git a/lib/libc/string/wcscmp.c b/lib/libc/string/wcscmp.c
index f81fa702f61..652b84b5d18 100644
--- a/lib/libc/string/wcscmp.c
+++ b/lib/libc/string/wcscmp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wcscmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */
+/* $NetBSD: wcscmp.c,v 1.6 2009/01/02 00:20:21 tnozaki Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,13 +37,13 @@
#if 0
static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: wcscmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $");
+__RCSID("$NetBSD: wcscmp.c,v 1.6 2009/01/02 00:20:21 tnozaki Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include <assert.h>
#include <wchar.h>
-#include "locale/runetype.h"
+#include "runetype.h"
/*
* Compare strings.
diff --git a/lib/libc/string/wcsncmp.c b/lib/libc/string/wcsncmp.c
index 5fe8354b57c..45345c8aca2 100644
--- a/lib/libc/string/wcsncmp.c
+++ b/lib/libc/string/wcsncmp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wcsncmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */
+/* $NetBSD: wcsncmp.c,v 1.6 2009/01/02 00:20:21 tnozaki Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -34,13 +34,13 @@
#if 0
static char sccsid[] = "@(#)strncmp.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: wcsncmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $");
+__RCSID("$NetBSD: wcsncmp.c,v 1.6 2009/01/02 00:20:21 tnozaki Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#include <assert.h>
#include <wchar.h>
-#include "locale/runetype.h"
+#include "runetype.h"
int
wcsncmp(s1, s2, n)
diff --git a/lib/libc/string/wcswidth.c b/lib/libc/string/wcswidth.c
deleted file mode 100644
index 801089ef07f..00000000000
--- a/lib/libc/string/wcswidth.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $NetBSD: wcswidth.c,v 1.5 2008/08/12 21:59:27 tnozaki Exp $ */
-
-/*-
- * Copyright (c)1999 Citrus Project,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * citrus Id: wcswidth.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wcswidth.c,v 1.5 2008/08/12 21:59:27 tnozaki Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <assert.h>
-#include <wchar.h>
-
-int
-wcswidth(s, n)
- const wchar_t *s;
- size_t n;
-{
- int w, x;
-
- _DIAGASSERT(s != NULL);
-
- w = 0;
- while (n && *s) {
- x = wcwidth(*s);
- if (x < 0)
- return -1;
- w += x;
- s++;
- n--;
- }
-
- return w;
-}
diff --git a/lib/libc/string/wmemcmp.c b/lib/libc/string/wmemcmp.c
index d7db891f654..4ceeb30289e 100644
--- a/lib/libc/string/wmemcmp.c
+++ b/lib/libc/string/wmemcmp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $ */
+/* $NetBSD: wmemcmp.c,v 1.4 2009/01/02 00:20:21 tnozaki Exp $ */
/*-
* Copyright (c)1999 Citrus Project,
@@ -30,12 +30,12 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $");
+__RCSID("$NetBSD: wmemcmp.c,v 1.4 2009/01/02 00:20:21 tnozaki Exp $");
#endif /* LIBC_SCCS and not lint */
#include <assert.h>
#include <wchar.h>
-#include "locale/runetype.h"
+#include "runetype.h"
int
wmemcmp(s1, s2, n)