1 '\" te
   2 .\" Copyright 1989 AT&T.  Copyright (c) 2003, Sun Microsystems, Inc.  All Rights Reserved. Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
   3 .\" 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
   4 .\" http://www.opengroup.org/bookstore/.
   5 .\" 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.
   6 .\"  This notice shall appear on any product containing this material.
   7 .\" 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.
   8 .\" 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.
   9 .\" 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]
  10 .TH STRXFRM 3C "Dec 10, 2003"
  11 .SH NAME
  12 strxfrm, strxfrm_l \- string transformation
  13 .SH SYNOPSIS
  14 .LP
  15 .nf
  16 #include <string.h>
  17 
  18 \fBsize_t\fR \fBstrxfrm\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBsize_t\fR \fIn\fR);
  19 \fBsize_t\fR \fBstrxfrm_l\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBsize_t\fR \fIn\fR, \fBlocale_t\fR \fIloc\fR);
  20 .fi
  21 
  22 .SH DESCRIPTION
  23 .sp
  24 .LP
  25 The \fBstrxfrm()\fR function transforms the string pointed to by \fIs2\fR and
  26 places the resulting string into the array pointed to by \fIs1\fR. The
  27 transformation is such that if \fBstrcmp\fR(3C) is applied to two transformed
  28 strings, it returns a value greater than, equal to or less than \fB0\fR,
  29 corresponding to the result of \fBstrcoll\fR(3C) applied to the same two
  30 original strings. No more than \fIn\fR bytes are placed into the resulting
  31 array pointed to by \fIs1\fR, including the terminating null byte.  If \fIn\fR
  32 is \fB0\fR, \fIs1\fR is permitted to be a null pointer. If copying takes place
  33 between objects that overlap, the behavior is undefined.
  34 .sp
  35 .LP
  36 The \fBstrxfrm()\fR function does not change the setting of \fBerrno\fR if
  37 successful.
  38 .sp
  39 .LP
  40 Since no return value is reserved to indicate an error, an application wishing
  41 to check for error situations should set \fBerrno\fR to 0, then call
  42 \fBstrxfrm()\fR, then check \fBerrno\fR.
  43 .sp
  44 .LP
  45 The \fBstrxfrm_l()\fR functions behaves identically to the function
  46 \fBstrxfrm()\fR, except instead of operating in the current environment it
  47 operates in the environment specified by the argument \fIloc\fR.
  48 .SH RETURN VALUES
  49 .sp
  50 .LP
  51 Upon successful completion, \fBstrxfrm()\fR returns the length of the
  52 transformed string (not including the terminating null byte). If the value
  53 returned is \fIn\fR or more, the contents of the array pointed to by \fIs1\fR
  54 are indeterminate.
  55 .sp
  56 .LP
  57 On error, \fBstrxfrm()\fR may set \fBerrno\fR but no return value is reserved
  58 to indicate the error.
  59 .SH USAGE
  60 .sp
  61 .LP
  62 The transformation function is such that two transformed strings can be ordered
  63 by \fBstrcmp\fR(3C) as appropriate to collating sequence information in the
  64 program's locale (category \fBLC_COLLATE\fR).
  65 .sp
  66 .LP
  67 The fact that when \fIn\fR is \fB0\fR, \fIs1\fR is permitted to be a null
  68 pointer, is useful to determine the size of the \fIs1\fR array prior to making
  69 the transformation.
  70 .SH EXAMPLES
  71 .LP
  72 \fBExample 1 \fRA sample of using the \fBstrxfm()\fR function.
  73 .sp
  74 .LP
  75 The value of the following expression is the size of the array needed to hold
  76 the transformation of the string pointed to by \fIs\fR.
  77 
  78 .sp
  79 .in +2
  80 .nf
  81 1 + strxfrm(NULL, s, 0);
  82 .fi
  83 .in -2
  84 
  85 .SH FILES
  86 .sp
  87 .ne 2
  88 .na
  89 \fB\fB/usr/lib/locale/\fIlocale\fR/\fIlocale\fR.so.*\fR\fR
  90 .ad
  91 .sp .6
  92 .RS 4n
  93 \fBLC_COLLATE\fR database for \fIlocale\fR
  94 .RE
  95 
  96 .SH ATTRIBUTES
  97 .sp
  98 .LP
  99 See \fBattributes\fR(5) for descriptions of the following attributes:
 100 .sp
 101 
 102 .sp
 103 .TS
 104 box;
 105 c | c
 106 l | l .
 107 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 108 _
 109 CSI     Enabled
 110 _
 111 Interface Stability     Standard
 112 _
 113 MT-Level        MT-Safe with exceptions
 114 .TE
 115 
 116 .sp
 117 .LP
 118 The \fBstrxfrm()\fR function can be used safely in a multithreaded application,
 119 as long as \fBsetlocale\fR(3C) is not being called to change the locale.
 120 .SH SEE ALSO
 121 .sp
 122 .LP
 123 \fBlocaledef\fR(1), \fBsetlocale\fR(3C), \fBstrcmp\fR(3C), \fBstrcoll\fR(3C),
 124 \fBwscoll\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)