diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi index aea2d75ee7ba..3d2a8ab3854e 100644 --- a/distrib/sets/lists/comp/mi +++ b/distrib/sets/lists/comp/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2438 2023/07/28 18:18:59 christos Exp $ +# $NetBSD: mi,v 1.2439 2023/07/31 17:38:28 christos Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.comp comp-sys-root @@ -11154,6 +11154,7 @@ ./usr/share/man/cat3/wmemcmp.0 comp-c-catman .cat ./usr/share/man/cat3/wmemcpy.0 comp-c-catman .cat ./usr/share/man/cat3/wmemmove.0 comp-c-catman .cat +./usr/share/man/cat3/wmempcpy.0 comp-c-catman .cat ./usr/share/man/cat3/wmemset.0 comp-c-catman .cat ./usr/share/man/cat3/wmouse_trafo.0 comp-c-catman .cat ./usr/share/man/cat3/wmove.0 comp-c-catman .cat @@ -19553,6 +19554,7 @@ ./usr/share/man/html3/wmemcmp.html comp-c-htmlman html ./usr/share/man/html3/wmemcpy.html comp-c-htmlman html ./usr/share/man/html3/wmemmove.html comp-c-htmlman html +./usr/share/man/html3/wmempcpy.html comp-c-htmlman html ./usr/share/man/html3/wmemset.html comp-c-htmlman html ./usr/share/man/html3/wmouse_trafo.html comp-c-htmlman html ./usr/share/man/html3/wmove.html comp-c-htmlman html @@ -28024,6 +28026,7 @@ ./usr/share/man/man3/wmemcmp.3 comp-c-man .man ./usr/share/man/man3/wmemcpy.3 comp-c-man .man ./usr/share/man/man3/wmemmove.3 comp-c-man .man +./usr/share/man/man3/wmempcpy.3 comp-c-man .man ./usr/share/man/man3/wmemset.3 comp-c-man .man ./usr/share/man/man3/wmouse_trafo.3 comp-c-man .man ./usr/share/man/man3/wmove.3 comp-c-man .man diff --git a/include/wchar.h b/include/wchar.h index 7b51a04c9d1d..e01706cd4c16 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wchar.h,v 1.44 2020/03/20 01:08:42 joerg Exp $ */ +/* $NetBSD: wchar.h,v 1.45 2023/07/31 17:38:28 christos Exp $ */ /*- * Copyright (c)1999 Citrus Project, @@ -130,6 +130,7 @@ 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 *wmempcpy(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); diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc index 37b8754ad45f..9cf3647462a9 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.85 2021/04/14 08:07:49 mrg Exp $ +# $NetBSD: Makefile.inc,v 1.86 2023/07/31 17:38:28 christos Exp $ # string sources .PATH: ${ARCHDIR}/string ${.CURDIR}/string @@ -29,7 +29,7 @@ SRCS+= popcount32.c popcount64.c SRCS+= wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c \ wcslen.c wcsncat.c wcsnlen.c wcscasecmp.c wcsdup.c wcsncasecmp.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 + wcswcs.c wmemchr.c wmemcmp.c wmemcpy.c wmemmove.c wmempcpy.c wmemset.c CPPFLAGS.wcscmp.c+= -I${LIBCDIR}/locale CPPFLAGS.wcsncmp.c+= -I${LIBCDIR}/locale CPPFLAGS.wmemcmp.c+= -I${LIBCDIR}/locale @@ -74,7 +74,8 @@ MLINKS+=strerror.3 strerror_r.3 strerror.3 perror.3 \ MLINKS+=strdup.3 strndup.3 MLINKS+=strsep.3 stresep.3 MLINKS+=wmemchr.3 wmemcmp.3 wmemchr.3 wmemcpy.3 \ - wmemchr.3 wmemmove.3 wmemchr.3 wmemset.3 \ + wmemchr.3 wmemmove.3 wmemchr.3 wmempcpy.3 \ + wmemchr.3 wmemset.3 \ wmemchr.3 wcscat.3 wmemchr.3 wcschr.3 \ wmemchr.3 wcscmp.3 wmemchr.3 wcscpy.3 \ wmemchr.3 wcscspn.3 wmemchr.3 wcslcat.3 \ diff --git a/lib/libc/string/wmemchr.3 b/lib/libc/string/wmemchr.3 index 24b348bc927d..14d8392b4ef0 100644 --- a/lib/libc/string/wmemchr.3 +++ b/lib/libc/string/wmemchr.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: wmemchr.3,v 1.17 2016/10/15 14:22:00 kamil Exp $ +.\" $NetBSD: wmemchr.3,v 1.18 2023/07/31 17:38:28 christos Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -33,7 +33,7 @@ .\" .\" from: @(#)strcpy.3 8.1 (Berkeley) 6/4/93 .\" -.Dd October 15, 2016 +.Dd July 30, 2023 .Dt WMEMCHR 3 .Os .Sh NAME @@ -41,6 +41,7 @@ .Nm wmemcmp , .Nm wmemcpy , .Nm wmemmove , +.Nm wmempcpy , .Nm wmemset , .Nm wcscat , .Nm wcschr , @@ -73,6 +74,8 @@ .Ft wchar_t * .Fn wmemmove "wchar_t *s1" "const wchar_t *s2" "size_t n" .Ft wchar_t * +.Fn wmempcpy "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n" +.Ft wchar_t * .Fn wmemset "wchar_t *s" "wchar_t c" "size_t n" .Ft wchar_t * .Fn wcscat "wchar_t * restrict s1" "const wchar_t * restrict s2" @@ -203,9 +206,10 @@ function conforms to .St -p1003.1-2008 . .Pp The -.Fn wcslcat -and +.Fn wcslcat , .Fn wcslcpy +and +.Fn wmempcpy functions are .Nx extensions. diff --git a/lib/libc/string/wmempcpy.c b/lib/libc/string/wmempcpy.c new file mode 100644 index 000000000000..6eb62a8c54be --- /dev/null +++ b/lib/libc/string/wmempcpy.c @@ -0,0 +1,39 @@ +/* $NetBSD: wmempcpy.c,v 1.1 2023/07/31 17:38:28 christos Exp $ */ + +/*- + * Copyright (c) 2022 The NetBSD Foundation, Inc. + * 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 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. + */ + +#include +__RCSID("$NetBSD: wmempcpy.c,v 1.1 2023/07/31 17:38:28 christos Exp $"); + +#include +#include + +wchar_t * +wmempcpy(wchar_t *__restrict dst, const wchar_t *__restrict src, size_t len) +{ + return wmemcpy(dst, src, len) + len; +}