strncmp(D3) strncmp(D3)
NAME
strncmp - compare strings using a specified number of
characters
SYNOPSIS
#include <sys/types.h>
#include <sys/ddi.h>
int strncmp(const char *sptr1, const char *sptr2, size_t nchr);
Arguments
The arguments sptr1 and sptr2 each point to strings, and each
string is an array of characters terminated by a null-
character.
DESCRIPTION
The function strncmp compares at most nchr characters
(characters that follow a null-character are not compared) of
the string pointed to by sptr1 to the string pointed to by
sptr2.
Return Values
The function strncmp returns an integer value less than, equal
to or greater than zero to indicate whether at most nchr
characters of the possibly null-terminated string pointed to
by sptr1 is lexicographically less than, equal to or greater
than the possibly null-terminated string pointed to by sptr2.
USAGE
The function strncmp uses native character comparison. The
sign of the value returned when one of the characters has its
high-order bit set is implementation-dependent.
Level
Base or Interrupt.
Synchronization Constraints
Does not sleep.
Driver-defined basic locks, read/write locks, and sleep locks
may be held across calls to this function.
REFERENCES
bcmp(D3), bcopy(D3), strcmp(D3), strlen(D3)
Copyright 1994 Novell, Inc. Page 1
strncmp(D3) strncmp(D3)
NOTICES
Portability
All processors
Applicability
ddi: 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2