1 '\" te
   2 .\" Copyright (c) 2003, Sun Microsystems, Inc.  All Rights Reserved.
   3 .\" Copyright 1989 AT&T
   4 .\" Portions Copyright (c) 2001, the Institute of Electrical and Electronics Engineers, Inc. and The Open Group. All Rights Reserved.
   5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   6 .\" http://www.opengroup.org/bookstore/.
   7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   8 .\"  This notice shall appear on any product containing this material.
   9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
  10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  12 .TH STRCOLL 3C "Nov 1, 2003"
  13 .SH NAME
  14 strcoll \- string collation
  15 .SH SYNOPSIS
  16 .LP
  17 .nf
  18 #include <string.h>
  19 
  20 \fBint\fR \fBstrcoll\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR);
  21 .fi
  22 
  23 .SH DESCRIPTION
  24 .sp
  25 .LP
  26 Both \fBstrcoll()\fR and \fBstrxfrm\fR(3C) provide for locale-specific string
  27 sorting.  \fBstrcoll()\fR is intended for applications in which the number of
  28 comparisons per string is small. When strings are to be compared a number of
  29 times, \fBstrxfrm\fR(3C) is a more appropriate function because the
  30 transformation process occurs only once.
  31 .sp
  32 .LP
  33 The \fBstrcoll()\fR function does not change the setting of \fBerrno\fR if
  34 successful.
  35 .sp
  36 .LP
  37 Since no return value is reserved to indicate an error, an application wishing
  38 to check for error situations should set \fBerrno\fR to 0, then call
  39 \fBstrcoll()\fR, then check \fBerrno\fR.
  40 .SH RETURN VALUES
  41 .sp
  42 .LP
  43 Upon successful completion, \fBstrcoll()\fR returns an integer greater than,
  44 equal to, or less than zero in direct correlation to whether string \fIs1\fR is
  45 greater than, equal to, or less than the string \fIs2\fR.  The comparison is
  46 based on strings interpreted as appropriate to the program's locale  for
  47 category \fBLC_COLLATE\fR (see \fBsetlocale\fR(3C)).
  48 .sp
  49 .LP
  50 On error, \fBstrcoll()\fR may set \fBerrno\fR, but no return value is reserved
  51 to indicate an error.
  52 .SH ERRORS
  53 .sp
  54 .LP
  55 The \fBstrcoll()\fR function may fail if:
  56 .sp
  57 .ne 2
  58 .na
  59 \fB\fBEINVAL\fR\fR
  60 .ad
  61 .RS 10n
  62 The \fIs1\fR or \fIs2\fR arguments contain characters outside the domain of the
  63 collating sequence.
  64 .RE
  65 
  66 .SH FILES
  67 .sp
  68 .ne 2
  69 .na
  70 \fB\fB/usr/lib/locale/\fIlocale\fR/\fIlocale\fR.so.*\fR\fR
  71 .ad
  72 .sp .6
  73 .RS 4n
  74 \fBLC_COLLATE\fR database for \fIlocale\fR
  75 .RE
  76 
  77 .SH ATTRIBUTES
  78 .sp
  79 .LP
  80 See \fBattributes\fR(5) for descriptions of the following attributes:
  81 .sp
  82 
  83 .sp
  84 .TS
  85 box;
  86 c | c
  87 l | l .
  88 ATTRIBUTE TYPE  ATTRIBUTE VALUE
  89 _
  90 CSI     Enabled
  91 _
  92 Interface Stability     Standard
  93 _
  94 MT-Level        MT-Safe with exceptions
  95 .TE
  96 
  97 .sp
  98 .LP
  99 The \fBstrcoll()\fR function can be used safely in multithreaded applications,
 100 as long as \fBsetlocale\fR(3C) is not being called to change the locale.
 101 .SH SEE ALSO
 102 .sp
 103 .LP
 104 \fBlocaledef\fR(1), \fBsetlocale\fR(3C), \fBstring\fR(3C), \fBstrxfrm\fR(3C),
 105 \fBwsxfrm\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)