diff options
Diffstat (limited to 'man3/strcmp.3')
-rw-r--r-- | man3/strcmp.3 | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/man3/strcmp.3 b/man3/strcmp.3 index a37c3adfe..57b378e64 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-02-05 "Linux man-pages 6.03" +.TH strcmp 3 2023-07-20 "Linux man-pages 6.05.01" .SH NAME strcmp, strncmp \- compare two strings .SH LIBRARY @@ -79,24 +79,20 @@ match, or be greater than .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). -.ad l -.nh .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ +.na +.nh .BR strcmp (), .BR strncmp () T} Thread safety MT-Safe .TE -.hy -.ad .sp 1 -.SH STANDARDS -POSIX.1-2001, POSIX.1-2008, C99, SVr4, 4.3BSD. -.SH NOTES +.SH VERSIONS POSIX.1 specifies only that: .RS .PP @@ -114,6 +110,10 @@ the last compared byte in from the last compared byte in .IR s1 . (If the two characters are equal, this difference is 0.) +.SH STANDARDS +C11, POSIX.1-2008. +.SH HISTORY +POSIX.1-2001, C89, SVr4, 4.3BSD. .SH EXAMPLES The program below can be used to demonstrate the operation of .BR strcmp () @@ -160,28 +160,28 @@ $ \fB./string_comp ABC AB 2\fP .\" SRC BEGIN (string_comp.c) .EX /* string_comp.c - +\& Licensed under GNU General Public License v2 or later. */ #include <stdio.h> #include <stdlib.h> #include <string.h> - +\& int main(int argc, char *argv[]) { int res; - +\& if (argc < 3) { fprintf(stderr, "Usage: %s <str1> <str2> [<len>]\en", argv[0]); exit(EXIT_FAILURE); } - +\& if (argc == 3) res = strcmp(argv[1], argv[2]); else res = strncmp(argv[1], argv[2], atoi(argv[3])); - +\& if (res == 0) { printf("<str1> and <str2> are equal"); if (argc > 3) @@ -192,7 +192,7 @@ main(int argc, char *argv[]) } else { printf("<str1> is greater than <str2> (%d)\en", res); } - +\& exit(EXIT_SUCCESS); } .EE |