diff options
Diffstat (limited to '')
-rw-r--r-- | man3/strcmp.3 | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/man3/strcmp.3 b/man3/strcmp.3 index 57b378e..78fdf68 100644 --- a/man3/strcmp.3 +++ b/man3/strcmp.3 @@ -11,7 +11,7 @@ .\" Modified Sat Jul 24 18:08:52 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified 2001-08-31, aeb .\" -.TH strcmp 3 2023-07-20 "Linux man-pages 6.05.01" +.TH strcmp 3 2023-10-31 "Linux man-pages 6.7" .SH NAME strcmp, strncmp \- compare two strings .SH LIBRARY @@ -20,7 +20,7 @@ Standard C library .SH SYNOPSIS .nf .B #include <string.h> -.PP +.P .BI "int strcmp(const char *" s1 ", const char *" s2 ); .BI "int strncmp(const char " s1 [. n "], const char " s2 [. n "], size_t " n ); .fi @@ -34,7 +34,7 @@ and The locale is not taken into account (for a locale-aware comparison, see .BR strcoll (3)). The comparison is done using unsigned characters. -.PP +.P .BR strcmp () returns an integer indicating the result of the comparison, as follows: .IP \[bu] 3 @@ -53,7 +53,7 @@ a positive value if .I s1 is greater than .IR s2 . -.PP +.P The .BR strncmp () function is similar, except it compares @@ -91,18 +91,17 @@ T{ .BR strncmp () T} Thread safety MT-Safe .TE -.sp 1 .SH VERSIONS POSIX.1 specifies only that: .RS -.PP +.P The sign of a nonzero return value shall be determined by the sign of the difference between the values of the first pair of bytes (both interpreted as type .IR "unsigned char" ) that differ in the strings being compared. .RE -.PP +.P In glibc, as in most other implementations, the return value is the arithmetic result of subtracting the last compared byte in @@ -122,7 +121,7 @@ The program below can be used to demonstrate the operation of (when given three arguments). First, some examples using .BR strcmp (): -.PP +.P .in +4n .EX $ \fB./string_comp ABC ABC\fP @@ -137,16 +136,16 @@ $ .\fB/string_comp $\[aq]\e201\[aq] A\fP # 0201 \- 0101 = 0100 (or 64 decimal) <str1> is greater than <str2> (64) .EE .in -.PP +.P The last example uses .BR bash (1)-specific syntax to produce a string containing an 8-bit ASCII code; the result demonstrates that the string comparison uses unsigned characters. -.PP +.P And then some examples using .BR strncmp (): -.PP +.P .in +4n .EX $ \fB./string_comp ABC AB 3\fP |