Re: [PATCH 4/4] stpncpy(3) fixes

Alejandro Colomar
2023-11-21T18:29:49Z

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

On Mon, Nov 13, 2023 at 02:29:38AM +0100, Alejandro Colomar wrote:
> Hi Paul,
>
> On Sun, Nov 12, 2023 at 03:52:08PM -0800, Paul Eggert wrote:
> > Don't say "width" when "size" was meant.
> Ok
>
> > Prefer "byte" to the confusing word "character".
> Ok
>
> > Don't say that the source is a string; it need not be a string.
> As said in string.3, I'm not convinced by the new wording either.
>
> > Don't imply the result always has some null padding.
> Ok
>
> > Prefer standalone terminology.
> Ok
>
> > Fix indenting of prototype.
> Ok
>
> > Improve sample implementation by using memset rather than
> > the less-standard bzero,
>
> While bzero(3) is non-standard, it is simpler, so I prefer it.
>
> > and by not overwriting part of
> > the destination more than once which is confusing.
> Ok
>
> > Simplify example without losing its lessons.
> See some comments inline.
>
> > Use fwrite instead of printf to avoid assuming buffer length fits in int;
> Thanks! And even without the int issue, it's more consistent with
> handling non-terminated bytes.
>
> > although obviously this buffer length does fit, it's better if the sample
> > code is general.
> Yep.
>

I've applied some of the changes in separate commits:

6b050ad54 (HEAD -> contrib, alx/contrib) stpncpy.3: Reword, saying 'byte' instead of 'character'
be301345f stpncpy.3: EXAMPLES: errx(3) instead of warnx(3) if truncation occurs
d6499e777 stpncpy.3: EXAMPLES: Use fwrite(3) instead of printf(3)
2560770b2 stpncpy.3: NAME: Clarify that these functions only padd if necessary
7f19af378 stpncpy.3: Optimize possible implementation of stpncpy()
2f5a64243 stpncpy.3: SYNOPSIS: ffix
a845da18f stpncpy.3: Don't say 'width' when 'size' is meant

Cheers,