.\" .\" 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 .\" http://www.opengroup.org/bookstore/. .\" .\" 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 SunOS 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. .\" .\" This notice shall appear on any product containing this material. .\" .\" 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. .\" .\" 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. .\" .\" 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] .\" .\" .\" Copyright 1989 AT&T. .\" Portions Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. .\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 2014 Garrett D'Amore .\" .TH STRXFRM 3C "Jun 21, 2014" .SH NAME strxfrm, strxfrm_l \- string transformation .SH SYNOPSIS .LP .nf #include \fBsize_t\fR \fBstrxfrm\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR, \fBsize_t\fR \fIn\fR); .fi .LP .nf \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); .fi .SH DESCRIPTION .LP The \fBstrxfrm()\fR function transforms the string pointed to by \fIs2\fR and places the resulting string into the array pointed to by \fIs1\fR. The transformation is such that if \fBstrcmp\fR(3C) is applied to two transformed strings, it returns a value greater than, equal to or less than \fB0\fR, corresponding to the result of \fBstrcoll\fR(3C) applied to the same two original strings. No more than \fIn\fR bytes are placed into the resulting array pointed to by \fIs1\fR, including the terminating null byte. If \fIn\fR is \fB0\fR, \fIs1\fR is permitted to be a null pointer. If copying takes place between objects that overlap, the behavior is undefined. .LP The \fBstrxfrm()\fR function does not change the setting of \fBerrno\fR if successful. .LP Since no return value is reserved to indicate an error, an application wishing to check for error situations should set \fBerrno\fR to 0, then call \fBstrxfrm()\fR, then check \fBerrno\fR. .LP The \fBstrxfrm_l()\fR functions behaves identically to the function \fBstrxfrm()\fR, except instead of operating in the current locale it operates in the locale specified by the argument \fIloc\fR. .SH RETURN VALUES .LP Upon successful completion, \fBstrxfrm()\fR returns the length of the transformed string (not including the terminating null byte). If the value returned is \fIn\fR or more, the contents of the array pointed to by \fIs1\fR are indeterminate. .LP On error, \fBstrxfrm()\fR may set \fBerrno\fR but no return value is reserved to indicate the error. .SH USAGE .LP The transformation function is such that two transformed strings can be ordered by \fBstrcmp\fR(3C) as appropriate to collating sequence information in the locale (category \fBLC_COLLATE\fR). .LP The fact that when \fIn\fR is \fB0\fR, \fIs1\fR is permitted to be a null pointer, is useful to determine the size of the \fIs1\fR array prior to making the transformation. .SH EXAMPLES .LP \fBExample 1 \fRA sample of using the \fBstrxfm()\fR function. .LP The value of the following expression is the size of the array needed to hold the transformation of the string pointed to by \fIs\fR. .sp .in +2 .nf 1 + strxfrm(NULL, s, 0); .fi .in -2 .SH FILES .IP \fB/usr/lib/locale/\fR\fIlocale\fR\fB/LC_COLLATE/* collation database for \fIlocale\fR .SH ATTRIBUTES .LP See \fBattributes\fR(7) for descriptions of the following attributes: .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI Enabled _ Interface Stability Standard _ MT-Level MT-Safe .TE .SH SEE ALSO .LP .BR localedef (1), .BR newlocale (3C), .BR setlocale (3C), .BR strcmp (3C), .BR strcoll (3C), .BR uselocale (3C), .BR wscoll (3C), .BR attributes (7), .BR environ (7), .BR standards (7)