strcasecmp.3: Make details of strncasecmp() comparison clearer

Quoting Ori:

The manpage for strncasecmp has a few wording issues that can be improved:

1)
In the DESCRIPTION section, "except it compares only the first n
bytes of s1"

s1 can be shorter than n bytes. Consider adding "(at most)" after
"first".

For comparison with reference materials, POSIX uses the wording
"not more than n bytes", OSX and FreeBSD use "compares at
most [...]".

2)
In the RETURN VALUE section: "if s1 (or the first n bytes
thereof) is found [...] to match [...] s2"

This could theoretically be read to suggest that the first n bytes
of s1 are compared against the FULL s2, which is not the case.
Consider removing the parenthetical altogether (thus, not
mentioning 'n' at all). POSIX doesn't mention 'n' in its RETURN
VALUE section.

3)
The RETURN VALUE section doesn't mention case insensitivity. It's
in the DESCRIPTION, but perhaps it should also be in this section.
POSIX mentions case-insensitivity in RETURN VALUE.

Consider adding "and ignoring case" after "respectively".

Reported-by: Ori Avtalion <ori@avtalion.name>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2016-05-29 06:52:09 -05:00
parent cd32ec849d
commit 2392242b06
1 changed files with 5 additions and 6 deletions

View File

@ -55,8 +55,8 @@ respectively, to be less than, to match, or be greater than
.PP
The
.BR strncasecmp ()
function is similar, except it compares
only the first
function is similar, except that it compares
no more than
.I n
bytes of
.IR s1 .
@ -68,11 +68,10 @@ and
functions return
an integer less than, equal to, or greater than zero if
.I s1
(or the first
.I n
bytes thereof) is found, respectively, to be
is, after ignoring case, found to be
less than, to match, or be greater than
.IR s2 .
.IR s2 ,
respectively.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).