]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
strnlen.3: Fix a small inconsistency in the text
authorMichael Kerrisk <mtk.manpages@gmail.com>
Sat, 28 Nov 2020 09:00:23 +0000 (10:00 +0100)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Sat, 28 Nov 2020 09:00:23 +0000 (10:00 +0100)
Quoting Heinrich:

    The strnlen.3 manpage has the following sentence:

    "In doing this, strnlen() looks only at the first maxlen
    characters in the string pointed to by s and never beyond
    s+maxlen."

    This sentence is self-contradictory:

    The last visited character implied by "first maxlen
    characters" is s[maxlen-1].

    Given that "beyond a" does not include "a", the last visited
    character implied by "never beyond s+maxlen" is s[maxlen].

    A consistent sentence would be

    "In doing this, strnlen() looks only at the first maxlen
    characters in the string pointed to by s and never beyond
    s+maxlen-1."

    I would prefer

    "In doing this, strnlen() looks only at the first maxlen
    characters in the string pointed to by s and never beyond
    s[maxlen-1]"

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man3/strnlen.3

index 6c4b080fcd7d7fbb5e2a93f265004e1d70362ffc..d4385af496fab77272bc396575286a2d74268d92 100644 (file)
@@ -54,7 +54,7 @@ looks only at the first
 characters in the string pointed to by
 .I s
 and never beyond
-.IR s+maxlen .
+.IR s[maxlen\-1] .
 .SH RETURN VALUE
 The
 .BR strnlen ()