Re: strnlen.3: never beyond s+maxlen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/19/20 8:42 PM, Heinrich Schuchardt wrote:
> Hello Michael,
> 
> 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]"

Thanks, Heinrich. I changed as you suggested.

Cheers,

Michael

diff --git a/man3/strnlen.3 b/man3/strnlen.3
index 6c4b080fc..d4385af49 100644
--- a/man3/strnlen.3
+++ b/man3/strnlen.3
@@ -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 ()



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



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux