summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2012-11-25 17:18:57 +0100
committerMichael Kerrisk <mtk.manpages@gmail.com>2012-11-27 07:49:59 +0100
commit3b5b9fd8b5b8781cff011473f52ad2f81b9bce79 (patch)
treef89362538b4c805e8edde569837061c8edf12db1
parent27bada1fa1fc3de08a18fb370dd86f4103c60398 (diff)
memcmp.3: Enhance RETURN VALUE text and remove redundant text from DESCRIPTION
Note that sign of result equals sign of difference between first two bytes that differ (treated as "unsigned char")." Reported-by: Jon Grant <jg@jguk.org> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
-rw-r--r--man3/memcmp.313
1 files changed, 9 insertions, 4 deletions
diff --git a/man3/memcmp.3 b/man3/memcmp.3
index 853a2bfe..c9b0deb0 100644
--- a/man3/memcmp.3
+++ b/man3/memcmp.3
@@ -25,7 +25,7 @@
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\" 386BSD man pages
.\" Modified Sat Jul 24 18:55:27 1993 by Rik Faith (faith@cs.unc.edu)
-.TH MEMCMP 3 2011-09-14 "" "Linux Programmer's Manual"
+.TH MEMCMP 3 2012-11-25 "" "Linux Programmer's Manual"
.SH NAME
memcmp \- compare memory areas
.SH SYNOPSIS
@@ -40,9 +40,6 @@ The
function compares the first \fIn\fP bytes (each interpreted as
.IR "unsigned char" )
of the memory areas \fIs1\fP and \fIs2\fP.
-It returns an integer less than,
-equal to, or greater than zero if \fIs1\fP is found, respectively, to
-be less than, to match, or be greater than \fIs2\fP.
.SH "RETURN VALUE"
The
.BR memcmp ()
@@ -50,6 +47,14 @@ function returns an integer less than, equal to, or
greater than zero if the first \fIn\fP bytes of \fIs1\fP is found,
respectively, to be less than, to match, or be greater than the first
\fIn\fP bytes of \fIs2\fP.
+
+For a nonzero return value, the sign is determined by the sign of
+the difference between the first pair of bytes (interpreted as
+.IR "unsigned char" )
+that differ in
+.I s1
+and
+.IR s2 .
.SH "CONFORMING TO"
SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
.SH "SEE ALSO"