[Info-vax] ChatGPT solved it for me, again...
Simon Clubley
clubley at remove_me.eisner.decus.org-Earth.UFP
Mon Feb 20 08:09:21 EST 2023
On 2023-02-20, Johnny Billquist <bqt at softjar.se> wrote:
> On 2023-02-17 15:16, Simon Clubley wrote:
>> On 2023-02-17, Arne Vajhøj <arne at vajhoej.dk> wrote:
>>>
>>> strcspn will stop when it reach the terminating null byte.
>>>
>>
>> Are you sure about that ?
>>
>> https://linux.die.net/man/3/strcspn
>>
>> There's no mention of stopping at a null and no mention of what the
>> return value is when the byte is not found within the string if it
>> were to stop at a terminating null.
>
> Quoting the man-page I have locally:
>
> The strcspn() function spans the initial part of the null-terminated
> string s as long as the characters from s do not occur in the null-
> terminated string charset (it spans the complement of charset).
> In other
> words, it computes the string array index of the first character of s
> which is also in charset, else the index of the first null character.
>
>
BSD ?
That's what the Linux version should say. :-(
The way the Linux version is written, it came across as another gets()
style function, and given that someone at some time thought it was a
good idea to add gets() to the C RTL...
Simon.
--
Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.
More information about the Info-vax
mailing list