Module Name: src Committed By: riastradh Date: Mon Sep 9 11:30:06 UTC 2024
Modified Files: src/distrib/sets/lists/comp: mi src/lib/libc/locale: Makefile.inc mbsrtowcs.3 wcsrtombs.3 Log Message: mbsnrtowcs(3), wcsnrtombs(3): Add man pages for these mouthfuls. Based on patch drafted by abhinav@, with a little additional tidying by me. PR standards/52343: wcsnrtombs missing man-page To generate a diff of this commit: cvs rdiff -u -r1.2472 -r1.2473 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.67 -r1.68 src/lib/libc/locale/Makefile.inc cvs rdiff -u -r1.12 -r1.13 src/lib/libc/locale/mbsrtowcs.3 cvs rdiff -u -r1.13 -r1.14 src/lib/libc/locale/wcsrtombs.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2472 src/distrib/sets/lists/comp/mi:1.2473 --- src/distrib/sets/lists/comp/mi:1.2472 Sun Aug 25 22:10:40 2024 +++ src/distrib/sets/lists/comp/mi Mon Sep 9 11:30:05 2024 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2472 2024/08/25 22:10:40 christos Exp $ +# $NetBSD: mi,v 1.2473 2024/09/09 11:30:05 riastradh Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.comp comp-sys-root @@ -9213,6 +9213,7 @@ ./usr/share/man/cat3/mbrtoc8.0 comp-c-catman .cat ./usr/share/man/cat3/mbrtowc.0 comp-c-catman .cat ./usr/share/man/cat3/mbsinit.0 comp-c-catman .cat +./usr/share/man/cat3/mbsnrtowcs.0 comp-c-catman .cat ./usr/share/man/cat3/mbsrtowcs.0 comp-c-catman .cat ./usr/share/man/cat3/mbstowcs.0 comp-c-catman .cat ./usr/share/man/cat3/mbtowc.0 comp-c-catman .cat @@ -11286,6 +11287,7 @@ ./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/wcsnrtombs.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 @@ -17713,6 +17715,7 @@ ./usr/share/man/html3/mbrtoc8.html comp-c-htmlman html ./usr/share/man/html3/mbrtowc.html comp-c-htmlman html ./usr/share/man/html3/mbsinit.html comp-c-htmlman html +./usr/share/man/html3/mbsnrtowcs.html comp-c-htmlman html ./usr/share/man/html3/mbsrtowcs.html comp-c-htmlman html ./usr/share/man/html3/mbstowcs.html comp-c-htmlman html ./usr/share/man/html3/mbtowc.html comp-c-htmlman html @@ -19764,6 +19767,7 @@ ./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/wcsnrtombs.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 @@ -26220,6 +26224,7 @@ ./usr/share/man/man3/mbrtoc8.3 comp-c-man .man ./usr/share/man/man3/mbrtowc.3 comp-c-man .man ./usr/share/man/man3/mbsinit.3 comp-c-man .man +./usr/share/man/man3/mbsnrtowcs.3 comp-c-man .man ./usr/share/man/man3/mbsrtowcs.3 comp-c-man .man ./usr/share/man/man3/mbstowcs.3 comp-c-man .man ./usr/share/man/man3/mbtowc.3 comp-c-man .man @@ -28312,6 +28317,7 @@ ./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/wcsnrtombs.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: src/lib/libc/locale/Makefile.inc diff -u src/lib/libc/locale/Makefile.inc:1.67 src/lib/libc/locale/Makefile.inc:1.68 --- src/lib/libc/locale/Makefile.inc:1.67 Thu Aug 15 21:19:45 2024 +++ src/lib/libc/locale/Makefile.inc Mon Sep 9 11:30:05 2024 @@ -1,5 +1,5 @@ # from: @(#)Makefile.inc 5.1 (Berkeley) 2/18/91 -# $NetBSD: Makefile.inc,v 1.67 2024/08/15 21:19:45 riastradh Exp $ +# $NetBSD: Makefile.inc,v 1.68 2024/09/09 11:30:05 riastradh Exp $ # locale sources .PATH: ${ARCHDIR}/locale ${.CURDIR}/locale @@ -68,4 +68,7 @@ MLINKS+=wcstod.3 wcstof.3 wcstod.3 wcsto MLINKS+=wcstol.3 wcstoll.3 wcstol.3 wcstoimax.3 \ wcstol.3 wcstoul.3 wcstol.3 wcstoull.3 wcstol.3 wcstoumax.3 +MLINKS+=mbsrtowcs.3 mbsnrtowcs.3 +MLINKS+=wcsrtombs.3 wcsnrtombs.3 + COPTS.wcsftime.c = -Wno-format-nonliteral Index: src/lib/libc/locale/mbsrtowcs.3 diff -u src/lib/libc/locale/mbsrtowcs.3:1.12 src/lib/libc/locale/mbsrtowcs.3:1.13 --- src/lib/libc/locale/mbsrtowcs.3:1.12 Thu Dec 16 17:42:27 2010 +++ src/lib/libc/locale/mbsrtowcs.3 Mon Sep 9 11:30:05 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: mbsrtowcs.3,v 1.12 2010/12/16 17:42:27 wiz Exp $ +.\" $NetBSD: mbsrtowcs.3,v 1.13 2024/09/09 11:30:05 riastradh Exp $ .\" .\" Copyright (c)2002 Citrus Project, .\" All rights reserved. @@ -24,12 +24,13 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 4, 2002 +.Dd September 9, 2024 .Dt MBSRTOWCS 3 .Os .\" ---------------------------------------------------------------------- .Sh NAME .Nm mbsrtowcs +.Nm mbsrntowcs .Nd converts a multibyte character string to a wide-character string \ (restartable) .\" ---------------------------------------------------------------------- @@ -41,11 +42,15 @@ .Ft size_t .Fn mbsrtowcs "wchar_t * restrict pwcs" "const char ** restrict s" "size_t n" \ "mbstate_t * restrict ps" +.Fn mbsnrtowcs "wchar_t * restrict pwcs" "const char ** restrict s" \ +"size_t nmc" "size_t n" \ +"mbstate_t * restrict ps" .\" ---------------------------------------------------------------------- .Sh DESCRIPTION The .Fn mbsrtowcs -converts the multibyte character string indirectly pointed to by +function converts the multibyte character string indirectly pointed to +by .Fa s to the corresponding wide-character string, and stores it in the array pointed to by @@ -120,10 +125,22 @@ never changes the internal state of .Fn mbsrtowcs , which is initialized at startup time of the program. .El +.Pp +The +.Fn mbsnrtowcs +function behaves identically to +.Fn mbsrtowcs , +except that the conversion stops after reading at most +.Fa nmc +characters from the buffer pointed to by +.Fa s . .\" ---------------------------------------------------------------------- .Sh RETURN VALUES +The .Fn mbsrtowcs -returns: +and +.Fn mbsnrtowcs +functions return: .Bl -tag -width 012345678901 .It 0 or positive The value returned is the number of elements stored in the array @@ -155,13 +172,16 @@ to indicate the error. .El .\" ---------------------------------------------------------------------- .Sh ERRORS +The .Fn mbsrtowcs -may cause an error in the following case: +and +.Fn mbsnrtowcs +functions may fail with the following errors: .Bl -tag -width Er .It Bq Er EILSEQ -The pointer pointed to by .Fa s -points to an invalid or incomplete multibyte character. +points to a string containing an invalid or incomplete multibyte +character. .It Bq Er EINVAL .Fa ps points to an invalid or uninitialized mbstate_t object. @@ -177,5 +197,12 @@ The .Fn mbsrtowcs function conforms to .St -isoC-amd1 . -The restrict qualifier is added at +The +.Li restrict +qualifier was added by .St -isoC-99 . +.Pp +The +.Fn mbsnrtowcs +function conforms to +.St -p1003.1-2008 . Index: src/lib/libc/locale/wcsrtombs.3 diff -u src/lib/libc/locale/wcsrtombs.3:1.13 src/lib/libc/locale/wcsrtombs.3:1.14 --- src/lib/libc/locale/wcsrtombs.3:1.13 Thu Dec 16 17:42:27 2010 +++ src/lib/libc/locale/wcsrtombs.3 Mon Sep 9 11:30:05 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: wcsrtombs.3,v 1.13 2010/12/16 17:42:27 wiz Exp $ +.\" $NetBSD: wcsrtombs.3,v 1.14 2024/09/09 11:30:05 riastradh Exp $ .\" .\" Copyright (c)2002 Citrus Project, .\" All rights reserved. @@ -24,12 +24,12 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd August 8, 2006 +.Dd August 27, 2017 .Dt WCSRTOMBS 3 .Os .\" ---------------------------------------------------------------------- .Sh NAME -.Nm wcsrtombs +.Nm wcsrtombs, wcsnrtombs .Nd converts a wide-character string to a multibyte character string \ (restartable) .\" ---------------------------------------------------------------------- @@ -41,12 +41,15 @@ .Ft size_t .Fn wcsrtombs "char * restrict s" "const wchar_t ** restrict pwcs" \ "size_t n" "mbstate_t * restrict ps" +.Ft size_t +.Fn wcsnrtombs "char * restrict s" "const wchar_t ** restrict pwcs" \ +"size_t nwc" "size_t n" "mbstat_t * restrict ps" .\" ---------------------------------------------------------------------- .Sh DESCRIPTION The .Fn wcsrtombs -converts the nul-terminated wide-character string indirectly pointed -to by +function converts the nul-terminated wide-character string indirectly +pointed to by .Fa pwcs to the corresponding multibyte character string, and stores it in the array pointed to by @@ -124,10 +127,22 @@ state of .Fn wcsrtombs , which is initialized at startup time of the program. .El +.Pp +The +.Fn wcsnrtombs +function behaves identically to +.Fn wcsrtombs , +except that the conversion stops after reading at most +.Fa nwc +characters from the buffer pointed to by +.Fa pwcs . .\" ---------------------------------------------------------------------- .Sh RETURN VALUES +The .Fn wcsrtombs -returns: +and +.Fn wcsnrtombs +functions return: .Bl -tag -width 012345678901 .It 0 or positive Number of bytes stored in the array pointed to by @@ -154,12 +169,18 @@ to indicate the error. .El .\" ---------------------------------------------------------------------- .Sh ERRORS +The .Fn wcsrtombs -may cause an error in the following case: +and +.Fn wcsnrtombs +functions may fail with the following errors: .Bl -tag -width Er .It Bq Er EILSEQ .Fa pwcs points to a string containing an invalid wide character. +.It Bq Er EINVAL +.Fa ps +points to an invalid or uninitialized mbstate_t object. .El .\" ---------------------------------------------------------------------- .Sh SEE ALSO @@ -172,5 +193,12 @@ The .Fn wcsrtombs function conforms to .St -ansiC . -The restrict qualifier is added at +The +.Li restrict +qualifier was added by .St -isoC-99 . +.Pp +The +.Fn wcsnrtombs +function conforms to +.St -p1003.1-2008 .