linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* strcpy compared to POSIX strcpy
@ 2020-06-29 13:41 Jonny Grant
  2020-06-29 20:30 ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 3+ messages in thread
From: Jonny Grant @ 2020-06-29 13:41 UTC (permalink / raw)
  To: Michael Kerrisk; +Cc: linux-man

Hi Michael,

Returning to an old topic, noticed strcpy man page is different from the POSIX spec with regards to "terminating NUL character" or "null-terminated" shouldn't man pages should follow POSIX style writing "NUL"?

https://man7.org/linux/man-pages/man3/strcpy.3.html

https://man7.org/linux/man-pages/man3/strcpy.3p.html

https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcpy.html

Another function even has nul in the name
https://man7.org/linux/man-pages/man3/strchrnul.3.html


Regards, Jonny

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: strcpy compared to POSIX strcpy
  2020-06-29 13:41 strcpy compared to POSIX strcpy Jonny Grant
@ 2020-06-29 20:30 ` Michael Kerrisk (man-pages)
  2020-06-30 10:59   ` Jonny Grant
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-06-29 20:30 UTC (permalink / raw)
  To: Jonny Grant; +Cc: linux-man

Hi Jonny

On Mon, 29 Jun 2020 at 15:41, Jonny Grant <jg@jguk.org> wrote:
>
> Hi Michael,
>
> Returning to an old topic, noticed strcpy man page is different from the POSIX spec with regards to "terminating NUL character" or "null-terminated" shouldn't man pages should follow POSIX style writing "NUL"?
>
> https://man7.org/linux/man-pages/man3/strcpy.3.html
>
> https://man7.org/linux/man-pages/man3/strcpy.3p.html
>
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcpy.html
>
> Another function even has nul in the name
> https://man7.org/linux/man-pages/man3/strchrnul.3.html

It's not so simple. In POSIX/SUS, you will find variously:

terminating NUL character
terminating NUL
terminating null character
terminating null byte

There's even one instance of "terminating NULL character" (in
<net/if.h>; I estimate it's a bug).

In the C standard (C11), "terminating null character" seems to be used
exclusively, but as I understand the C standard [char == byte] by
definition.

I've tried to consistently use "terminating null byte" across all
pages in man-pages. See also the discussion in man-pages(7).

Cheers,

Michael






-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: strcpy compared to POSIX strcpy
  2020-06-29 20:30 ` Michael Kerrisk (man-pages)
@ 2020-06-30 10:59   ` Jonny Grant
  0 siblings, 0 replies; 3+ messages in thread
From: Jonny Grant @ 2020-06-30 10:59 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man



On 29/06/2020 21:30, Michael Kerrisk (man-pages) wrote:
> Hi Jonny
> 
> On Mon, 29 Jun 2020 at 15:41, Jonny Grant <jg@jguk.org> wrote:
>>
>> Hi Michael,
>>
>> Returning to an old topic, noticed strcpy man page is different from the POSIX spec with regards to "terminating NUL character" or "null-terminated" shouldn't man pages should follow POSIX style writing "NUL"?
>>
>> https://man7.org/linux/man-pages/man3/strcpy.3.html
>>
>> https://man7.org/linux/man-pages/man3/strcpy.3p.html
>>
>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcpy.html
>>
>> Another function even has nul in the name
>> https://man7.org/linux/man-pages/man3/strchrnul.3.html
> 
> It's not so simple. In POSIX/SUS, you will find variously:
> 
> terminating NUL character
> terminating NUL
> terminating null character
> terminating null byte
> 
> There's even one instance of "terminating NULL character" (in
> <net/if.h>; I estimate it's a bug).
> 
> In the C standard (C11), "terminating null character" seems to be used
> exclusively, but as I understand the C standard [char == byte] by
> definition.
> 
> I've tried to consistently use "terminating null byte" across all
> pages in man-pages. See also the discussion in man-pages(7).

Hi Michael,

It is good you have made things consistent. It sounds like you can't make the POSIX man pages the same, as that comes from the POSIX spec right?

BTW,  net/if.h looks okay on my Ubuntu LTS, line 36 does have:
    char *if_name;		/* null terminated name: "eth0", ... */

Cheers, Jonny

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-30 10:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 13:41 strcpy compared to POSIX strcpy Jonny Grant
2020-06-29 20:30 ` Michael Kerrisk (man-pages)
2020-06-30 10:59   ` Jonny Grant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).