Index: distrib/sets/lists/comp/mi =================================================================== RCS file: /public/netbsd-rsync/src/distrib/sets/lists/comp/mi,v retrieving revision 1.2064 diff -u -r1.2064 mi --- distrib/sets/lists/comp/mi 4 Oct 2016 09:41:40 -0000 1.2064 +++ distrib/sets/lists/comp/mi 15 Oct 2016 12:12:37 -0000 @@ -9540,6 +9540,7 @@ ./usr/share/man/cat3/wcsncat.0 comp-c-catman .cat ./usr/share/man/cat3/wcsncmp.0 comp-c-catman .cat ./usr/share/man/cat3/wcsncpy.0 comp-c-catman .cat +./usr/share/man/cat3/wcsnlen.0 comp-c-catman .cat ./usr/share/man/cat3/wcspbrk.0 comp-c-catman .cat ./usr/share/man/cat3/wcsrchr.0 comp-c-catman .cat ./usr/share/man/cat3/wcsrtombs.0 comp-c-catman .cat @@ -16745,6 +16746,7 @@ ./usr/share/man/html3/wcsncat.html comp-c-htmlman html ./usr/share/man/html3/wcsncmp.html comp-c-htmlman html ./usr/share/man/html3/wcsncpy.html comp-c-htmlman html +./usr/share/man/html3/wcsnlen.html comp-c-htmlman html ./usr/share/man/html3/wcspbrk.html comp-c-htmlman html ./usr/share/man/html3/wcsrchr.html comp-c-htmlman html ./usr/share/man/html3/wcsrtombs.html comp-c-htmlman html @@ -24021,6 +24023,7 @@ ./usr/share/man/man3/wcsncat.3 comp-c-man .man ./usr/share/man/man3/wcsncmp.3 comp-c-man .man ./usr/share/man/man3/wcsncpy.3 comp-c-man .man +./usr/share/man/man3/wcsnlen.3 comp-c-man .man ./usr/share/man/man3/wcspbrk.3 comp-c-man .man ./usr/share/man/man3/wcsrchr.3 comp-c-man .man ./usr/share/man/man3/wcsrtombs.3 comp-c-man .man Index: lib/libc/string/Makefile.inc =================================================================== RCS file: /public/netbsd-rsync/src/lib/libc/string/Makefile.inc,v retrieving revision 1.80 diff -u -r1.80 Makefile.inc --- lib/libc/string/Makefile.inc 24 Sep 2014 18:16:37 -0000 1.80 +++ lib/libc/string/Makefile.inc 15 Oct 2016 11:24:26 -0000 @@ -27,7 +27,7 @@ # wide char 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 \ + 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 CPPFLAGS.wcscmp.c+= -I${LIBCDIR}/locale @@ -71,8 +71,9 @@ wmemchr.3 wcscmp.3 wmemchr.3 wcscpy.3 \ wmemchr.3 wcscspn.3 wmemchr.3 wcslcat.3 \ wmemchr.3 wcslcpy.3 wmemchr.3 wcslen.3 \ - wmemchr.3 wcsncat.3 wmemchr.3 wcsncmp.3 \ - wmemchr.3 wcsncpy.3 wmemchr.3 wcspbrk.3 \ - wmemchr.3 wcsrchr.3 wmemchr.3 wcsspn.3 \ - wmemchr.3 wcsstr.3 wmemchr.3 wcswcs.3 + wmemchr.3 wcsncat.3 wmemchr.3 wcsnlen.3 + wmemchr.3 wcsncmp.3 wmemchr.3 wcsncpy.3 \ + wmemchr.3 wcspbrk.3 wmemchr.3 wcsrchr.3 \ + wmemchr.3 wcsspn.3 wmemchr.3 wcsstr.3 \ + wmemchr.3 wcswcs.3 MLINKS+=wcscasecmp.3 wcsncasecmp.3 Index: lib/libc/string/wcsnlen.c =================================================================== RCS file: lib/libc/string/wcsnlen.c diff -N lib/libc/string/wcsnlen.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/libc/string/wcsnlen.c 15 Oct 2016 11:08:25 -0000 @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2016 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Kamil Rytarowski. + * + * 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$"); + +#include +#include + +size_t +wcsnlen(const wchar_t *s, size_t maxlen) +{ + const wchar_t *p; + + _DIAGASSERT(s != NULL); + + p = s; + while (maxlen-->0 && *p) { + p++; + } + + return p - s; +} Index: lib/libc/string/wmemchr.3 =================================================================== RCS file: /public/netbsd-rsync/src/lib/libc/string/wmemchr.3,v retrieving revision 1.16 diff -u -r1.16 wmemchr.3 --- lib/libc/string/wmemchr.3 14 Jul 2016 17:17:58 -0000 1.16 +++ lib/libc/string/wmemchr.3 15 Oct 2016 12:09:45 -0000 @@ -33,7 +33,7 @@ .\" .\" from: @(#)strcpy.3 8.1 (Berkeley) 6/4/93 .\" -.Dd May 1, 2009 +.Dd October 15, 2016 .Dt WMEMCHR 3 .Os .Sh NAME @@ -53,6 +53,7 @@ .Nm wcsncat , .Nm wcsncmp , .Nm wcsncpy , +.Nm wcsnlen , .Nm wcspbrk , .Nm wcsrchr , .Nm wcsspn , @@ -95,6 +96,8 @@ .Fn wcsncmp "const wchar_t *s1" "const wchar_t * s2" "size_t n" .Ft wchar_t * .Fn wcsncpy "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n" +.Ft size_t +.Fn wcsnlen "const wchar_t *s" "size_t maxlen" .Ft wchar_t * .Fn wcspbrk "const wchar_t *s1" "const wchar_t *s2" .Ft wchar_t * @@ -147,16 +150,62 @@ .Xr strspn 3 , .Xr strstr 3 .Sh STANDARDS -These functions conform to -.St -isoC-99 -and were first introduced in -.St -isoC-amd1 , -with the exception of -.Fn wcslcat +The +.Fn wmemchr , +.Fn wmemcmp , +.Fn wmemcpy , +.Fn wmemmove , +.Fn wmemset , +.Fn wcscat , +.Fn wcschr , +.Fn wcscmp , +.Fn wcscpy , +.Fn wcscspn , +.Fn wcslen , +.Fn wcsncat , +.Fn wcsncmp , +.Fn wcsncpy , +.Fn wcspbrk , +.Fn wcsrchr , +.Fn wcsspn +and +.Fn wcsstr +functions were first introduced in +.St -isoC-amd1 +and conform to +.St -isoC-99 . +Part of them: +.Fn wmemmove , +.Fn wcscat , +.Fn wcscpy , +.Fn wcsncat and -.Fn wcslcpy , -which are extensions. +.Fn wcsncpy +were modified in +.St -isoC-99 +and gained the +.Dv restrict +keyword in parameter list, +this new version is present in +.Nx . +.Pp The .Fn wcswcs function conforms to -.St -xpg4.2 . +.St -xpg4.2 , +it is recommended to use technically equivalent +.Fn wcsstr +for maximum portability. +.Pp +The +.Fn wcsnlen +function conforms to +.St -p1003.1-2008 . +.Pp +The +.Fn wcslcat +and +.Fn wcslcpy +functions are +.Nx +extensions.