summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-04-14 20:59:11 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-04-14 20:59:11 +0000
commit8961b6d2bcfa838422b67f6facb27a1375abcd2f (patch)
treea44e4a49529af82e0aee3e4d2bab71f6eab9f8aa
parentdb99574f1c4b47d92725407923b9f2447a166f03 (diff)
introduce some wchar functions (from citrus and an itojun@ diff)
okay deraadt@, cloder@, pvalchev@ thanks to everyone who commented on that.
-rw-r--r--include/Makefile5
-rw-r--r--include/stddef.h7
-rw-r--r--include/wchar.h133
-rw-r--r--include/wctype.h57
-rw-r--r--lib/libc/locale/Makefile.inc4
-rw-r--r--lib/libc/locale/runetype.h11
-rw-r--r--lib/libc/shlib_version2
-rw-r--r--lib/libc/string/Makefile.inc29
8 files changed, 240 insertions, 8 deletions
diff --git a/include/Makefile b/include/Makefile
index 1f4bfc33e0a..0ad4bc9bc12 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.129 2004/10/20 22:12:15 fgsch Exp $
+# $OpenBSD: Makefile,v 1.130 2005/04/14 20:59:10 espie Exp $
# $NetBSD: Makefile,v 1.59 1996/05/15 21:36:43 jtc Exp $
# @(#)Makefile 5.45.1.1 (Berkeley) 5/6/91
@@ -21,7 +21,8 @@ FILES= a.out.h ar.h assert.h bitstring.h blf.h bm.h bsd_auth.h cast.h \
readpassphrase.h regex.h resolv.h rmd160.h search.h setjmp.h \
sgtty.h sha1.h sha2.h skipjack.h signal.h stab.h stdbool.h stddef.h \
stdio.h stdlib.h string.h strings.h struct.h sysexits.h tar.h \
- time.h ttyent.h tzfile.h unistd.h utime.h utmp.h vis.h
+ time.h ttyent.h tzfile.h unistd.h utime.h utmp.h vis.h \
+ wchar.h wctype.h
FILES+= link.h link_aout.h link_elf.h
diff --git a/include/stddef.h b/include/stddef.h
index 34cdd635635..5a818e71e3a 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stddef.h,v 1.6 2003/06/02 19:34:12 millert Exp $ */
+/* $OpenBSD: stddef.h,v 1.7 2005/04/14 20:59:10 espie Exp $ */
/* $NetBSD: stddef.h,v 1.4 1994/10/26 00:56:26 cgd Exp $ */
/*-
@@ -52,6 +52,11 @@ typedef _BSD_WCHAR_T_ wchar_t;
#endif
#endif
+#ifdef _BSD_WINT_T_
+typedef _BSD_WINT_T_ wint_t;
+#undef _BSD_WINT_T_
+#endif
+
#ifndef NULL
#ifdef __GNUG__
#define NULL __null
diff --git a/include/wchar.h b/include/wchar.h
new file mode 100644
index 00000000000..a6703cd8d90
--- /dev/null
+++ b/include/wchar.h
@@ -0,0 +1,133 @@
+/* $OpenBSD: wchar.h,v 1.1 2005/04/14 20:59:10 espie Exp $ */
+/* $NetBSD: wchar.h,v 1.16 2003/03/07 07:11:35 tshiozak 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.
+ */
+
+/*-
+ * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Julian Coleman.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifndef _WCHAR_H_
+#define _WCHAR_H_
+
+#include <sys/cdefs.h>
+#include <machine/ansi.h>
+
+#ifndef NULL
+#ifdef __GNUG__
+#define NULL __null
+#else
+#define NULL 0L
+#endif
+#endif
+
+#include <stdio.h> /* for FILE* */
+
+#ifdef _BSD_WCHAR_T_
+typedef _BSD_WCHAR_T_ wchar_t;
+#undef _BSD_WCHAR_T_
+#endif
+
+#ifdef _BSD_WINT_T_
+typedef _BSD_WINT_T_ wint_t;
+#undef _BSD_WINT_T_
+#endif
+
+#ifdef _BSD_SIZE_T_
+typedef _BSD_SIZE_T_ size_t;
+#undef _BSD_SIZE_T_
+#endif
+
+#ifndef WEOF
+#define WEOF ((wint_t)-1)
+#endif
+
+__BEGIN_DECLS
+wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
+wchar_t *wcschr(const wchar_t *, wchar_t);
+int wcscmp(const wchar_t *, const wchar_t *);
+int wcscoll(const wchar_t *, const wchar_t *);
+wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
+size_t wcscspn(const wchar_t *, const wchar_t *);
+size_t wcslen(const wchar_t *);
+wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict,
+ size_t);
+int wcsncmp(const wchar_t *, const wchar_t *, size_t);
+wchar_t *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict,
+ size_t);
+wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
+wchar_t *wcsrchr(const wchar_t *, wchar_t);
+size_t wcsspn(const wchar_t *, const wchar_t *);
+wchar_t *wcsstr(const wchar_t *, const wchar_t *);
+wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict,
+ wchar_t ** __restrict);
+size_t wcsxfrm(wchar_t *, const wchar_t *, size_t);
+wchar_t *wcswcs(const wchar_t *, const wchar_t *);
+wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
+int wmemcmp(const wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict,
+ size_t);
+wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
+wchar_t *wmemset(wchar_t *, wchar_t, size_t);
+
+size_t wcslcat(wchar_t *, const wchar_t *, size_t);
+size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
+__END_DECLS
+
+#endif /* !_WCHAR_H_ */
diff --git a/include/wctype.h b/include/wctype.h
new file mode 100644
index 00000000000..248fdf366af
--- /dev/null
+++ b/include/wctype.h
@@ -0,0 +1,57 @@
+/* $OpenBSD: wctype.h,v 1.1 2005/04/14 20:59:10 espie Exp $ */
+/* $NetBSD: wctype.h,v 1.5 2003/03/02 22:18:11 tshiozak 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: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp
+ */
+
+#ifndef _WCTYPE_H_
+#define _WCTYPE_H_
+
+#include <sys/cdefs.h>
+#include <machine/ansi.h>
+
+#ifdef _BSD_WINT_T_
+typedef _BSD_WINT_T_ wint_t;
+#undef _BSD_WINT_T_
+#endif
+
+#ifdef _BSD_WCTRANS_T_
+typedef _BSD_WCTRANS_T_ wctrans_t;
+#undef _BSD_WCTRANS_T_
+#endif
+
+#ifdef _BSD_WCTYPE_T_
+typedef _BSD_WCTYPE_T_ wctype_t;
+#undef _BSD_WCTYPE_T_
+#endif
+
+#ifndef WEOF
+#define WEOF ((wint_t)-1)
+#endif
+
+#endif /* _WCTYPE_H_ */
diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc
index 0784dda22f3..d5b0ae30a2c 100644
--- a/lib/libc/locale/Makefile.inc
+++ b/lib/libc/locale/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.4 1998/11/20 11:18:42 d Exp $
+# $OpenBSD: Makefile.inc,v 1.5 2005/04/14 20:59:10 espie Exp $
# locale sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/locale ${LIBCSRCDIR}/locale
@@ -8,3 +8,5 @@ SRCS+= _def_messages.c _def_monetary.c _def_numeric.c _def_time.c \
MAN+= nl_langinfo.3 setlocale.3
MLINKS+=setlocale.3 localeconv.3
+
+CFLAGS+=-I${.CURDIR}
diff --git a/lib/libc/locale/runetype.h b/lib/libc/locale/runetype.h
new file mode 100644
index 00000000000..f47d6a03129
--- /dev/null
+++ b/lib/libc/locale/runetype.h
@@ -0,0 +1,11 @@
+/* $OpenBSD: runetype.h,v 1.1 2005/04/14 20:59:10 espie Exp $ */
+
+#ifndef _NB_RUNETYPE_H_
+#define _NB_RUNETYPE_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+typedef uint32_t __nbrune_t;
+
+#endif
diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version
index 02fa089d23f..413ae7a8418 100644
--- a/lib/libc/shlib_version
+++ b/lib/libc/shlib_version
@@ -1,4 +1,4 @@
major=35
-minor=0
+minor=1
# note: If changes were made to include/thread_private.h or if system
# calls were added/changed then libpthread must also be updated.
diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc
index 81be9cea0ad..40bc016a867 100644
--- a/lib/libc/string/Makefile.inc
+++ b/lib/libc/string/Makefile.inc
@@ -1,11 +1,15 @@
-# $OpenBSD: Makefile.inc,v 1.14 2005/03/30 03:04:19 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.15 2005/04/14 20:59:10 espie Exp $
# string sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/string ${LIBCSRCDIR}/string
SRCS+= bm.c memccpy.c strcasecmp.c strcasestr.c strcoll.c strdup.c \
strerror.c strerror_r.c strlcat.c strmode.c strsignal.c strtok.c \
- strxfrm.c __strsignal.c
+ strxfrm.c __strsignal.c \
+ wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c \
+ wcslen.c wcsncat.c wcsncmp.c wcsncpy.c wcspbrk.c wcsrchr.c wcsspn.c \
+ wcsstr.c wcstok.c wcswcs.c wmemchr.c wmemcmp.c wmemcpy.c \
+ wmemmove.c wmemset.c
# machine-dependent net sources
# m-d Makefile.inc must include sources for:
@@ -138,7 +142,8 @@ MAN+= bm.3 bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 memccpy.3 memchr.3 \
memcmp.3 memcpy.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \
strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strerror.3 \
string.3 strlen.3 strmode.3 strdup.3 strpbrk.3 strrchr.3 strsep.3 \
- strsignal.3 strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 strlcpy.3
+ strsignal.3 strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 strlcpy.3 \
+ wcstok.3 wmemchr.3
MLINKS+=bm.3 bm_comp.3 bm.3 bm_exec.3 bm.3 bm_free.3
MLINKS+=strchr.3 index.3
@@ -151,3 +156,21 @@ MLINKS+=strlcpy.3 strlcat.3
MLINKS+=strstr.3 strcasestr.3
MLINKS+=strtok.3 strtok_r.3
MLINKS+=strerror.3 strerror_r.3
+MLINKS+=wmemchr.3 wmemcmp.3
+MLINKS+=wmemchr.3 wmemcpy.3
+MLINKS+=wmemchr.3 wmemmove.3
+MLINKS+=wmemchr.3 wmemset.3
+MLINKS+=wmemchr.3 wcscat.3
+MLINKS+=wmemchr.3 wcschr.3
+MLINKS+=wmemchr.3 wcscmp.3
+MLINKS+=wmemchr.3 wcscpy.3
+MLINKS+=wmemchr.3 wcscspn.3
+MLINKS+=wmemchr.3 wcslcat.3
+MLINKS+=wmemchr.3 wcslcpy.3
+MLINKS+=wmemchr.3 wcsncat.3
+MLINKS+=wmemchr.3 wcsncmp.3
+MLINKS+=wmemchr.3 wcsncpy.3
+MLINKS+=wmemchr.3 wcspbrk.3
+MLINKS+=wmemchr.3 wcspbrk.3
+MLINKS+=wmemchr.3 wcsspn.3
+MLINKS+=wmemchr.3 wcsstr.3