Re: [PATCH] mbsrtowcs.3: add a note for conversion completion

Alejandro Colomar
2023-11-14T10:04:50Z

[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]

Hi Andriy,

On Tue, Nov 14, 2023 at 09:47:36AM +0000, Andriy Utkin wrote:
> On Tue, Nov 14, 2023 at 10:21:27AM +0100, Alejandro Colomar wrote:
> > mbstowcs(3) has the following:
> >
> > In order to avoid the case 2 above, the programmer should make
> > sure n is greater than or equal to mbstowcs(NULL,src,0)+1.
> >
> > We could add that.
>
> That might have enlightened me! I like the wording, and indeed, having
> it phrased the same way for these similar functions would be helpful.

I've applied a few patches to these pages:

<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=06783b90b57459437eb4a91b127523cc61fb1173>

>
> > BTW, maybe you want to use mbstowcs(3), which is simpler.
>
> Indeed I should have chosen that.
>
> > I think we could add something saying that mbsrtowcs(3) is a
> > restartable version of mbstowcs(3).
>
> It might have helped me, and probably will help others.

<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=b94a9c18d89c5c3a7a649c83e16de8034509c04e>

And a few more to be able to diff the pages with

$ diff -u <(man mbstowcs) <(man mbsrtowcs)

Which I had to use to understand the differences.

<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=6f9e8feeb8d0c391b0e5eb3a2b4dc2d7eab4d098>
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=f77ff4a87d2ca676b81f6919676634ab126a18b2>
<https://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git/commit/?h=contrib&id=fcfa4c254f0454d34a9370e2051c84069183a46b>

Cheers,
Alex

>
> Thanks Alejandro!

--
<https://www.alejandro-colomar.es/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]