Browse Source

introduce some wchar functions (from citrus and an itojun@ diff)

okay deraadt@, cloder@, pvalchev@
thanks to everyone who commented on that.
OPENBSD_3_8
espie 19 years ago
parent
commit
5e8683629a
5 changed files with 225 additions and 6 deletions
  1. +3
    -2
      src/include/Makefile
  2. +6
    -1
      src/include/stddef.h
  3. +133
    -0
      src/include/wchar.h
  4. +57
    -0
      src/include/wctype.h
  5. +26
    -3
      src/lib/libc/string/Makefile.inc

+ 3
- 2
src/include/Makefile View File

@ -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


+ 6
- 1
src/include/stddef.h View File

@ -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


+ 133
- 0
src/include/wchar.h View File

@ -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_ */

+ 57
- 0
src/include/wctype.h View File

@ -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_ */

+ 26
- 3
src/lib/libc/string/Makefile.inc View File

@ -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

Loading…
Cancel
Save