Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: TBD
   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 \- 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 .fi
  20 




  21 .SH DESCRIPTION
  22 .sp
  23 .LP
  24 The \fBstrxfrm()\fR function transforms the string pointed to by \fIs2\fR and
  25 places the resulting string into the array pointed to by \fIs1\fR. The
  26 transformation is such that if \fBstrcmp\fR(3C) is applied to two transformed
  27 strings, it returns a value greater than, equal to or less than \fB0\fR,
  28 corresponding to the result of \fBstrcoll\fR(3C) applied to the same two
  29 original strings. No more than \fIn\fR bytes are placed into the resulting
  30 array pointed to by \fIs1\fR, including the terminating null byte.  If \fIn\fR
  31 is \fB0\fR, \fIs1\fR is permitted to be a null pointer. If copying takes place
  32 between objects that overlap, the behavior is undefined.
  33 .sp
  34 .LP
  35 The \fBstrxfrm()\fR function does not change the setting of \fBerrno\fR if
  36 successful.
  37 .sp
  38 .LP
  39 Since no return value is reserved to indicate an error, an application wishing
  40 to check for error situations should set \fBerrno\fR to 0, then call
  41 \fBstrxfrm()\fR, then check \fBerrno\fR.




  42 .SH RETURN VALUES
  43 .sp
  44 .LP
  45 Upon successful completion, \fBstrxfrm()\fR returns the length of the
  46 transformed string (not including the terminating null byte). If the value
  47 returned is \fIn\fR or more, the contents of the array pointed to by \fIs1\fR
  48 are indeterminate.
  49 .sp
  50 .LP
  51 On error, \fBstrxfrm()\fR may set \fBerrno\fR but no return value is reserved
  52 to indicate the error.
  53 .SH USAGE
  54 .sp
  55 .LP
  56 The transformation function is such that two transformed strings can be ordered
  57 by \fBstrcmp\fR(3C) as appropriate to collating sequence information in the
  58 program's locale (category \fBLC_COLLATE\fR).
  59 .sp
  60 .LP
  61 The fact that when \fIn\fR is \fB0\fR, \fIs1\fR is permitted to be a null
  62 pointer, is useful to determine the size of the \fIs1\fR array prior to making
  63 the transformation.
  64 .SH EXAMPLES
  65 .LP
  66 \fBExample 1 \fRA sample of using the \fBstrxfm()\fR function.
  67 .sp
  68 .LP
  69 The value of the following expression is the size of the array needed to hold
  70 the transformation of the string pointed to by \fIs\fR.
  71 
  72 .sp
  73 .in +2
  74 .nf
  75 1 + strxfrm(NULL, s, 0);
  76 .fi
  77 .in -2
  78 
  79 .SH FILES
  80 .sp
  81 .ne 2
  82 .na
  83 \fB\fB/usr/lib/locale/\fIlocale\fR/\fIlocale\fR.so.*\fR\fR
  84 .ad
  85 .sp .6
  86 .RS 4n
  87 \fBLC_COLLATE\fR database for \fIlocale\fR
  88 .RE
  89 
  90 .SH ATTRIBUTES
  91 .sp
  92 .LP
  93 See \fBattributes\fR(5) for descriptions of the following attributes:
  94 .sp
  95 
  96 .sp
  97 .TS
  98 box;
  99 c | c
 100 l | l .
 101 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 102 _
 103 CSI     Enabled
 104 _
 105 Interface Stability     Standard
 106 _
 107 MT-Level        MT-Safe with exceptions
 108 .TE
 109 
 110 .sp
 111 .LP
 112 The \fBstrxfrm()\fR function can be used safely in a multithreaded application,
 113 as long as \fBsetlocale\fR(3C) is not being called to change the locale.
 114 .SH SEE ALSO
 115 .sp
 116 .LP
 117 \fBlocaledef\fR(1), \fBsetlocale\fR(3C), \fBstrcmp\fR(3C), \fBstrcoll\fR(3C),

 118 \fBwscoll\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
   1 '\" te
   2 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
   3 .\" Copyright 1989 AT&T.  Copyright (c) 2003, Sun Microsystems, Inc.  All Rights Reserved. Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
   4 .\" 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
   5 .\" http://www.opengroup.org/bookstore/.
   6 .\" 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.
   7 .\"  This notice shall appear on any product containing this material.
   8 .\" 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.
   9 .\" 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.
  10 .\" 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]
  11 .TH STRXFRM 3C "Jun 21, 2014"
  12 .SH NAME
  13 strxfrm, strxfrm_l \- string transformation
  14 .SH SYNOPSIS
  15 .LP
  16 .nf
  17 #include <string.h>
  18 
  19 \fBsize_t\fR \fBstrxfrm\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBsize_t\fR \fIn\fR);
  20 .fi
  21 .LP
  22 .nf
  23 \fBsize_t\fR \fBstrxfrm_l\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBsize_t\fR \fIn\fR,
  24     \fBlocale_t\fR \fIloc\fR);
  25 .fi
  26 .SH DESCRIPTION

  27 .LP
  28 The \fBstrxfrm()\fR function transforms the string pointed to by \fIs2\fR and
  29 places the resulting string into the array pointed to by \fIs1\fR. The
  30 transformation is such that if \fBstrcmp\fR(3C) is applied to two transformed
  31 strings, it returns a value greater than, equal to or less than \fB0\fR,
  32 corresponding to the result of \fBstrcoll\fR(3C) applied to the same two
  33 original strings. No more than \fIn\fR bytes are placed into the resulting
  34 array pointed to by \fIs1\fR, including the terminating null byte.  If \fIn\fR
  35 is \fB0\fR, \fIs1\fR is permitted to be a null pointer. If copying takes place
  36 between objects that overlap, the behavior is undefined.

  37 .LP
  38 The \fBstrxfrm()\fR function does not change the setting of \fBerrno\fR if
  39 successful.

  40 .LP
  41 Since no return value is reserved to indicate an error, an application wishing
  42 to check for error situations should set \fBerrno\fR to 0, then call
  43 \fBstrxfrm()\fR, then check \fBerrno\fR.
  44 .LP
  45 The \fBstrxfrm_l()\fR functions behaves identically to the function
  46 \fBstrxfrm()\fR, except instead of operating in the current locale it
  47 operates in the locale specified by the argument \fIloc\fR.
  48 .SH RETURN VALUES

  49 .LP
  50 Upon successful completion, \fBstrxfrm()\fR returns the length of the
  51 transformed string (not including the terminating null byte). If the value
  52 returned is \fIn\fR or more, the contents of the array pointed to by \fIs1\fR
  53 are indeterminate.

  54 .LP
  55 On error, \fBstrxfrm()\fR may set \fBerrno\fR but no return value is reserved
  56 to indicate the error.
  57 .SH USAGE

  58 .LP
  59 The transformation function is such that two transformed strings can be ordered
  60 by \fBstrcmp\fR(3C) as appropriate to collating sequence information in the
  61 locale (category \fBLC_COLLATE\fR).

  62 .LP
  63 The fact that when \fIn\fR is \fB0\fR, \fIs1\fR is permitted to be a null
  64 pointer, is useful to determine the size of the \fIs1\fR array prior to making
  65 the transformation.
  66 .SH EXAMPLES
  67 .LP
  68 \fBExample 1 \fRA sample of using the \fBstrxfm()\fR function.

  69 .LP
  70 The value of the following expression is the size of the array needed to hold
  71 the transformation of the string pointed to by \fIs\fR.
  72 
  73 .sp
  74 .in +2
  75 .nf
  76 1 + strxfrm(NULL, s, 0);
  77 .fi
  78 .in -2
  79 
  80 .SH FILES
  81 .IP \fB/usr/lib/locale/\fR\fIlocale\fR\fB/LC_COLLATE/*
  82 collation database for \fIlocale\fR








  83 .SH ATTRIBUTES

  84 .LP
  85 See \fBattributes\fR(5) for descriptions of the following attributes:



  86 .TS
  87 box;
  88 c | c
  89 l | l .
  90 ATTRIBUTE TYPE  ATTRIBUTE VALUE
  91 _
  92 CSI     Enabled
  93 _
  94 Interface Stability     Standard
  95 _
  96 MT-Level        MT-Safe
  97 .TE
  98 




  99 .SH SEE ALSO

 100 .LP
 101 \fBlocaledef\fR(1), \fBnewlocale\fR(3C), \fBsetlocale\fR(3C), \fBstrcmp\fR(3C),
 102 \fBstrcoll\fR(3C), \fBuselocale\fR(3C),
 103 \fBwscoll\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)