AW: Suggestion for edit

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

 



the posix page is more direct about that.

"The sign of a non-zero return value shall be determined by the sign of the difference between the values of the first  pair  of     bytes (both interpreted as type unsigned char) that differ in the strings being compared."

re,
 wh
________________________________________
Von: Andrew Micallef <andrew.micallef@xxxxxxxxxxx>
Gesendet: Dienstag, 7. April 2020 11:45:03
An: Walter Harms; linux-man@xxxxxxxxxxxxxxx
Betreff: Re: Suggestion for edit

Hi Walter


Actually that new phrasing on the last sentence is much clearer. I was scratching my head over what it meant for a string to be less than (or greater than) another string.

Cheers
Andrew




From: Walter Harms <wharms@xxxxxx>

Sent: Tuesday, 7 April 2020 7:17 PM

To: Andrew Micallef <andrew.micallef@xxxxxxxxxxx>; linux-man@xxxxxxxxxxxxxxx <linux-man@xxxxxxxxxxxxxxx>

Subject: AW: Suggestion for edit




hi Andrew, i have to admit that i dropped over the last sentence. And it should be *very* clear what the return means,

ehre my idea:



If both strings are equal the function returns 0.

Otherwises it returns the differences between the last compared characters.



The last feature is important for sorting. I never found a good wording for that.



re,

 wh







________________________________________

Von: linux-man-owner@xxxxxxxxxxxxxxx <linux-man-owner@xxxxxxxxxxxxxxx> im Auftrag von Andrew Micallef <andrew.micallef@xxxxxxxxxxx>

Gesendet: Dienstag, 7. April 2020 09:07:50

An: linux-man@xxxxxxxxxxxxxxx

Betreff: Fw: Suggestion for edit



Hi,





I'd like to suggest an edit to the description of `strcmp` in the standard C library man page.

I found this description to be kind of confusing, and think the language could be a bit more

straight forward.







 At present the description reads as follows:



The strcmp() function compares the two strings s1 and s2.  The locale

       is not taken into account (for a locale-aware comparison, see

       strcoll(3)).  It returns an integer less than, equal to, or greater

       than zero if s1 is found, respectively, to be less than, to match, or

       be greater than s2.



I am suggesting the following edits:



The strcmp() function compares the two strings s1 and s2.  The locale

       is not taken into account (for a locale-aware comparison, see

       strcoll(3)).  It returns an integer, which is 0 if the strings

       match. Otherwise, a negative integer indicates s1 is less than s2,

       while a positive integer indicates s1 is greater than s2.





Regards

Andrew







[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