* [PATCH] man/man3/strcmp.3: replace equal/less/greater words
@ 2026-03-10 13:52 Ben Song
2026-03-16 0:25 ` Alejandro Colomar
0 siblings, 1 reply; 3+ messages in thread
From: Ben Song @ 2026-03-10 13:52 UTC (permalink / raw)
To: alx; +Cc: linux-man, Ben Song
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 <bensongsyz@gmail.com>
---
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
.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 .
.RE
.IP
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] man/man3/strcmp.3: replace equal/less/greater words
2026-03-10 13:52 [PATCH] man/man3/strcmp.3: replace equal/less/greater words Ben Song
@ 2026-03-16 0:25 ` Alejandro Colomar
2026-03-19 3:09 ` Ben Song
0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar @ 2026-03-16 0:25 UTC (permalink / raw)
To: Ben Song; +Cc: linux-man
[-- Attachment #1: Type: text/plain, Size: 2413 bytes --]
Hi Ben,
On 2026-03-10T21:52:48+0800, Ben Song wrote:
> 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 <bensongsyz@gmail.com>
> ---
> 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.
> .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>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [PATCH] man/man3/strcmp.3: replace equal/less/greater words
2026-03-16 0:25 ` Alejandro Colomar
@ 2026-03-19 3:09 ` Ben Song
0 siblings, 0 replies; 3+ messages in thread
From: Ben Song @ 2026-03-19 3:09 UTC (permalink / raw)
To: alx; +Cc: linux-man
> Please don't go past the 80-column right margin.
Got it, I will pay attention next time.
> I think I prefer entirely removing this list. We should defer to
> memcmp(3) for the description of the way the comparison is done.
Yes, the newer version is more concise, and the description I wrote in
strcmp is actually the same as what memcmp(3) describes.
Best regards!
Ben
p.s. Sorry for sending the reply mail to the wrong address. at https://lore.kernel.org/linux-man/21b3ebcd31a6f53968e2f987324d7d0c58c5243c.1773887744.git.bensongsyz@gmail.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-19 3:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 13:52 [PATCH] man/man3/strcmp.3: replace equal/less/greater words Ben Song
2026-03-16 0:25 ` Alejandro Colomar
2026-03-19 3:09 ` Ben Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox