Module Name: src Committed By: uwe Date: Fri Aug 16 12:54:08 UTC 2024
Modified Files: src/lib/libc/locale: c16rtomb.3 c32rtomb.3 Log Message: c16rtomb(3), c32rtomb(3): brush up markup To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libc/locale/c16rtomb.3 \ src/lib/libc/locale/c32rtomb.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/locale/c16rtomb.3 diff -u src/lib/libc/locale/c16rtomb.3:1.2 src/lib/libc/locale/c16rtomb.3:1.3 --- src/lib/libc/locale/c16rtomb.3:1.2 Thu Aug 15 14:58:00 2024 +++ src/lib/libc/locale/c16rtomb.3 Fri Aug 16 12:54:07 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: c16rtomb.3,v 1.2 2024/08/15 14:58:00 riastradh Exp $ +.\" $NetBSD: c16rtomb.3,v 1.3 2024/08/16 12:54:07 uwe Exp $ .\" .\" Copyright (c) 2024 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -36,11 +36,15 @@ .Lb libc .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .Sh SYNOPSIS +. .In uchar.h +. .Ft size_t -.Fn c16rtomb "char * restrict s" \ -"char16_t c16" \ -"mbstate_t * restrict ps" +.Fo c16rtomb +.Fa "char * restrict s" +.Fa "char16_t c16" +.Fa "mbstate_t * restrict ps" +.Fc .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .Sh DESCRIPTION The @@ -105,23 +109,23 @@ NUL-terminate it, and print it: char16_t c16[] = { 0xd83d, 0xdca9 }; char buf[__arraycount(c16)*MB_CUR_MAX + 1], *s = buf; size_t i; -mbstate_t mbs = {0}; /* initial conversion state */ +mbstate_t mbs = {0}; /* initial conversion state */ for (i = 0; i < __arraycount(c16); i++) { - size_t len; + size_t len; - len = c16rtomb(s, c16[i], &mbs); - if (len == (size_t)-1) - err(1, "c16rtomb"); - assert(len < sizeof(buf) - (s - buf)); - s += len; + len = c16rtomb(s, c16[i], &mbs); + if (len == (size_t)-1) + err(1, "c16rtomb"); + assert(len < sizeof(buf) - (s - buf)); + s += len; } -*s = '\e0'; /* NUL-terminate */ +*s = '\e0'; /* NUL-terminate */ printf("%s\en", buf); .Ed .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .Sh ERRORS -.Bl -tag -width ".Bq Er EILSEQ" +.Bl -tag -width Bq .It Bq Er EILSEQ A surrogate code point was passed as .Fa c16 @@ -185,7 +189,7 @@ in the standard which suggests that pass should unconditionally store a null byte and reset .Fa ps to the initial conversion state: -.Bd -offset indent +.Bd -filled -offset indent If .Fa c16 is a null wide character, a null byte is stored, preceded by any shift Index: src/lib/libc/locale/c32rtomb.3 diff -u src/lib/libc/locale/c32rtomb.3:1.2 src/lib/libc/locale/c32rtomb.3:1.3 --- src/lib/libc/locale/c32rtomb.3:1.2 Thu Aug 15 14:58:00 2024 +++ src/lib/libc/locale/c32rtomb.3 Fri Aug 16 12:54:07 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: c32rtomb.3,v 1.2 2024/08/15 14:58:00 riastradh Exp $ +.\" $NetBSD: c32rtomb.3,v 1.3 2024/08/16 12:54:07 uwe Exp $ .\" .\" Copyright (c) 2024 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -36,11 +36,15 @@ .Lb libc .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .Sh SYNOPSIS +. .In uchar.h +. .Ft size_t -.Fn c32rtomb "char * restrict s" \ -"char32_t c32" \ -"mbstate_t * restrict ps" +.Fo c32rtomb +.Fa "char * restrict s" +.Fa "char32_t c32" +.Fa "mbstate_t * restrict ps" +.Fc .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .Sh DESCRIPTION The @@ -63,7 +67,7 @@ of surrogate code points. .Pp If a surrogate code point is passed, .Nm - will return +will return .Li (size_t)-1 to denote failure with .Xr errno 2 @@ -88,23 +92,23 @@ NUL-terminate it, and print it: char32_t c32[] = { 0x1f4a9, 0x20ac, 0x21 }; char buf[__arraycountb(c32)*MB_CUR_MAX + 1], *s = buf; size_t i; -mbstate_t mbs = {0}; /* initial conversion state */ +mbstate_t mbs = {0}; /* initial conversion state */ for (i = 0; i < __arraycount(c32); i++) { - size_t len; + size_t len; - len = c32rtomb(s, c32[i], &mbs); - if (len == (size_t)-1) - err(1, "c32rtomb"); - assert(len < sizeof(buf) - (s - buf)); - s += len; + len = c32rtomb(s, c32[i], &mbs); + if (len == (size_t)-1) + err(1, "c32rtomb"); + assert(len < sizeof(buf) - (s - buf)); + s += len; } -*s = '\e0'; /* NUL-terminate */ +*s = '\e0'; /* NUL-terminate */ printf("%s\en", buf); .Ed .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .Sh ERRORS -.Bl -tag -width ".Bq Er EILSEQ" +.Bl -tag -width Bq .It Bq Er EILSEQ A surrogate code point was passed as .Fa c32 .