Thread (3 messages) 3 messages, 2 authors, 2026-03-19

Re: [PATCH] man/man3/strcmp.3: replace equal/less/greater words

From: Alejandro Colomar <alx@kernel.org>
Date: 2026-03-16 00:25:12

Hi Ben,

On 2026-03-10T21:52:48+0800, Ben Song wrote:
quoted hunk ↗ jump to hunk
There is no meaning for one string is `less than` or `greater than`
another string, but the value of a character in two strings can be
compared.

Signed-off-by: Ben Song <redacted>
---
 man/man3/strcmp.3 | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/man/man3/strcmp.3 b/man/man3/strcmp.3
index 2784d51c8..bc238aec1 100644
--- a/man/man3/strcmp.3
+++ b/man/man3/strcmp.3
@@ -23,11 +23,11 @@ .SH DESCRIPTION
 .BR strcmp ()
 The
 .BR strcmp ()
-function compares the two strings
+function compares the characters in two strings
 .I s1
 and
-.IR s2 .
-The locale is not taken into account (for a locale-aware comparison, see
+.I s2
+one by one until characters differ or until the end of one of the two strings is reached. The locale is not taken into account (for a locale-aware comparison, see
Please don't go past the 80-column right margin.

Also, use semantic newlines.  See man-pages(7):

$ MANWIDTH=72 man man-pages | awk '/Use semantic newlines/,/^$/'
   Use semantic newlines
     In the source of a manual page, new sentences should be started on
     new lines, long sentences should be split  into  lines  at  clause
     breaks  (commas,  semicolons, colons, and so on), and long clauses
     should be split at phrase boundaries.  This convention,  sometimes
     known as "semantic newlines", makes it easier to see the effect of
     patches, which often operate at the level of individual sentences,
     clauses, or phrases.
quoted hunk ↗ jump to hunk
 .BR strcoll (3)).
 The comparison is done using unsigned characters.
 .IP
@@ -39,16 +39,16 @@ .SH DESCRIPTION
 .I s1
 and
 .I s2
-are equal;
+are identical;
 .IP \[bu]
-a negative value if
+a negative value if the value of first different character in
 .I s1
-is less than
+is less than that in
 .IR s2 ;
 .IP \[bu]
-a positive value if
+a positive value if the value of first different character in
 .I s1
-is greater than
+is greater than that in
 .IR s2 .
I think I prefer entirely removing this list.  We should defer to
memcmp(3) for the description of the way the comparison is done.


Have a lovely night!
Alex
 .RE
 .IP
-- 
2.53.0
-- 
<https://www.alejandro-colomar.es>

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help