svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
strcasecmp(3c)
strcmp(3C) Standard C Library Functions strcmp(3C)
NAME
strcmp, strncmp, strcasecmp, strncasecmp, strcasecmp_l, strncasecmp_l -
string comparison
SYNOPSIS
#include <string.h>
int strcmp(const char *s1, const char *s2);
int strncmp(const char *s1, const char *s2, size_t n);
#include <strings.h>
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t n);
int strcasecmp_l(const char *s1, const char *s2, locale_t locale);
int strncasecmp_l(const char *s1, const char *s2, size_t n,
locale_t locale);
DESCRIPTION
These functions compare two strings (arrays of characters), and return
an integer greater than, equal to, or less than 0, if the string
pointed to by s1 is greater than, equal to, or less than the string
pointed to by s2 respectively. The strcmp(), strcasecmp(), and str‐
casecmp_l() functions require the strings to be terminated by a '\0'
character. The strncmp(), strncasecmp(), and strncasecmp_l() functions
limit their comparisons to no more than n bytes, allowing comparions of
either an initial subset of the strings or of non-terminated strings.
strcmp(), strncmp()
The strcmp() function compares two strings byte-by-byte, according to
the ordering of the "C" locale's character set. The function returns an
integer greater than, equal to, or less than 0, if the string pointed
to by s1 is greater than, equal to, or less than the string pointed to
by s2 respectively. The sign of a non-zero return value is determined
by the sign of the difference between the values of the first pair of
bytes that differ in the strings being compared. The strncmp() function
makes the same comparison but looks at a maximum of n bytes. Bytes fol‐
lowing a null byte are not compared.
strcasecmp(), strncasecmp()
The strcasecmp() and strncasecmp() functions are case-insensitive ver‐
sions of strcmp() and strncmp() respectively. They ignore differences
in case when comparing lowercase and uppercase characters, using the
current locale of the process to determine the case of the characters.
strcasecmp_l(), strncasecmp_l()
The strcasecmp_l() and strncasecmp_l() functions are versions of str‐
casecmp() and strncasecmp() respectively. They use the locale repre‐
sented by locale, instead of the current locale of the process.
The behavior is undefined if the locale argument is the special locale
object LC_GLOBAL_LOCALE or is not a valid locale object handle.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelAsync-Signal-
Safe _ StandardSee below
Standard
See standards(7) for descriptions of the following standards:
tab() box; cw(2.44i) |cw(3.06i) lw(2.44i) |lw(3.06i) INTERFACESAPPLICA‐
BLE STANDARDS _ strcmp(), strncmp()T{
C89 through C11,
POSIX.1-1990 through 2008,
SUS through SUSv4,
XPG1 through XPG7
T} _ strcasecmp(), strncasecmp()T{
POSIX.1-2001 through 2008,
SUSv3 through SUSv4,
XPG6 through XPG7
T} _ strcasecmp_l(), strncasecmp_l()T{
POSIX.1-2008,
SUSv4,
XPG7
T}
SEE ALSO
memcmp(3C), newlocale(3C), setlocale(3C), strcoll(3C), string(3C),
strxfrm(3C), u8_strcmp(3C), wcscmp(3C), wcscoll(3C), attributes(7),
standards(7)
NOTES
For some locales, strxfrm(3C) should be applied to the strings before
they are passed to the functions.
HISTORY
The strcasecmp_l() and strncasecmp_l() functions were added to Oracle
Solaris in the Solaris 11.4.0 release.
The strcmp(), strcasecmp(), strncasecmp(), strncmp() functions have
been included in all Sun and Oracle releases of Solaris.
Oracle Solaris 11.4 28 Feb 2022 strcmp(3C)