date and time created 91/03/06 18:09:53 by bostic
[unix-history] / usr / src / lib / libc / string / strncmp.3
CommitLineData
f945df90
KB
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
14strncmp \- compare strings of limited length
15.SH SYNOPSIS
16.nf
17.ft B
18#include <string.h>
19
20int
21strcmp(const char *s1, const char *s2, size_t len);
22.ft R
23.fi
24.SH DESCRIPTION
25.B Strncmp
26compares at most
27.I len
28characters in the null-terminated strings
29.I s1
30and
31.I s2
32and returns an integer greater than, equal to, or less than 0,
33according as
34.I s1
35is lexicographically greater than, equal to, or less than
36.IR s2 .
37The comparison is done using unsigned characters, so that '\e200'
38is greater than '\e0'.
39.SH SEE ALSO
40bcmp(3), memcmp(3), strcasecmp(3), strcmp(3), strcoll(3), strncasecmp(3),
41strxfrm(3)
42.SH STANDARDS
43.B Strncmp
44conforms to ANSI X3.159-1989 (``ANSI C'').