Bug#858866: libc6-dev: improve documentation for strchrnul
control: reassign -1 manpages-dev
control: retitle -1 manpages-dev: improve documentation for strchrnul
On 2017-03-28 00:38, Salvo Tomaselli wrote:
> Package: libc6-dev
> Version: 2.24-9
> Severity: normal
>
> Dear Maintainer,
>
> See this code:
>
> #include <stdio.h>
> #define _GNU_SOURCE
> #include <string.h>
> int main() {
> const char * filename = "cia<o.txt ";
> const char *ptr = filename + strlen(filename);
>
> char *pos = strchrnul(filename, (int)'<');
> if (pos < ptr)
> ptr = pos;
> printf("%d\n", ptr == filename + strlen(filename));
> }
>
> It doesn't work because the _GNU_SOURCE define happens after an include.
>
> The man page for strchrnul only specifies to define it before the string.h
> include, but probably it would be best to mention that it needs to be before
> any include, otherwise it's just undefined behaviour.
>
The manpage is not part of the glibc package. I am therefore reassigning
the bug to manpages-dev which provides it.
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
Reply to: