| 1 | .\" Copyright (c) 1990 The Regents of the University of California. |
| 2 | .\" All rights reserved. |
| 3 | .\" |
| 4 | .\" This code is derived from software contributed to Berkeley by |
| 5 | .\" Chris Torek. |
| 6 | .\" |
| 7 | .\" %sccs.include.redist.man% |
| 8 | .\" |
| 9 | .\" @(#)strncmp.3 5.1 (Berkeley) %G% |
| 10 | .\" |
| 11 | .TH STRNCMP 3 "" |
| 12 | .UC 4 |
| 13 | .SH NAME |
| 14 | strncmp \- compare strings of limited length |
| 15 | .SH SYNOPSIS |
| 16 | .nf |
| 17 | .ft B |
| 18 | #include <string.h> |
| 19 | |
| 20 | int |
| 21 | strcmp(const char *s1, const char *s2, size_t len); |
| 22 | .ft R |
| 23 | .fi |
| 24 | .SH DESCRIPTION |
| 25 | .B Strncmp |
| 26 | compares at most |
| 27 | .I len |
| 28 | characters in the null-terminated strings |
| 29 | .I s1 |
| 30 | and |
| 31 | .I s2 |
| 32 | and returns an integer greater than, equal to, or less than 0, |
| 33 | according as |
| 34 | .I s1 |
| 35 | is lexicographically greater than, equal to, or less than |
| 36 | .IR s2 . |
| 37 | The comparison is done using unsigned characters, so that '\e200' |
| 38 | is greater than '\e0'. |
| 39 | .SH SEE ALSO |
| 40 | bcmp(3), memcmp(3), strcasecmp(3), strcmp(3), strcoll(3), strncasecmp(3), |
| 41 | strxfrm(3) |
| 42 | .SH STANDARDS |
| 43 | .B Strncmp |
| 44 | conforms to ANSI X3.159-1989 (``ANSI C''). |