Print this page
5025 import and use mandoc
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Albert Lee <trisk@nexenta.com>
Approved by: TBD
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man3c/mbsrtowcs.3c
+++ new/usr/src/man/man3c/mbsrtowcs.3c
1 1 '\" te
2 2 .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
3 3 .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. Portions Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
4 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 5 .\" http://www.opengroup.org/bookstore/.
6 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 7 .\" This notice shall appear on any product containing this material.
8 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 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 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 11 .TH MBSRTOWCS 3C "Jun 28, 2014"
12 12 .SH NAME
13 13 mbsnrtwocs, mbsnrtowcs_l, mbsrtowcs, mbsrtowcs_l \- convert a character string
14 14 to a wide-character string (restartable)
15 15 .SH SYNOPSIS
16 16 .LP
17 17 .nf
18 18 #include <wchar.h>
19 19
20 20 \fBsize_t\fR \fBmbsnrtowcs\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR,
21 21 \fBsize_t\fR \fInms\fR, \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR);
22 22 .fi
23 23 .LP
24 24 .nf
25 25 \fBsize_t\fR \fBmbsrtowcs\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR,
26 26 \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR);
27 27 .fi
28 28 .LP
29 29 .nf
30 30 #include <wchar.h>
31 31 #include <xlocale.h>
32 32
33 33 \fBsize_t\fR \fBmbsnrtowcs_l\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR,
34 34 \fBsize_t\fR \fInms\fR, \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR, \fBlocale_t\fR \fIloc\fR);
35 35 .fi
36 36 .LP
37 37 .nf
38 38 \fBsize_t\fR \fBmbsrtowcs_l\fR(\fBwchar_t *restrict\fR \fIdst\fR, \fBconst char **restrict\fR \fIsrc\fR,
39 39 \fBsize_t\fR \fIlen\fR, \fBmbstate_t *restrict\fR \fIps\fR, \fBlocale_t\fR \fIloc\fR);
40 40 .fi
41 41 .SH DESCRIPTION
42 42 .LP
43 43 These function converts a sequence of characters, beginning in
44 44 the conversion state described by the object pointed to by \fIps\fR, from the
45 45 array indirectly pointed to by \fIsrc\fR into a sequence of corresponding
46 46 wide-characters. If \fIdst\fR is not a null pointer, the converted characters
47 47 are stored into the array pointed to by \fIdst\fR. Conversion continues up to
48 48 and including a terminating null character, which is also stored. Conversion
49 49 stops early in either of the following cases:
50 50 .RS +4
51 51 .TP
52 52 .ie t \(bu
53 53 .el o
54 54 When a sequence of bytes is encountered that does not form a valid character.
55 55 .RE
56 56 .RS +4
57 57 .TP
58 58 .ie t \(bu
59 59 .el o
60 60 When \fIlen\fR codes have been stored into the array pointed to by \fIdst\fR
61 61 (and \fIdst\fR is not a null pointer).
62 62 .RE
63 63 .LP
64 64 Each conversion takes place as if by a call to the \fBmbrtowc()\fR function.
65 65 .LP
66 66 If \fIdst\fR is not a null pointer, the pointer object pointed to by \fIsrc\fR
67 67 is assigned either a null pointer (if conversion stopped due to reaching a
68 68 terminating null character) or the address just past the last character
69 69 converted (if any). If conversion stopped due to reaching a terminating null
70 70 character, and if \fIdst\fR is not a null pointer, the resulting state
71 71 described is the initial conversion state.
72 72 .LP
73 73 If \fIps\fR is a null pointer, these functions uses their own
74 74 internal \fBmbstate_t\fR object, which is initialized at program startup to the
75 75 initial conversion state. Otherwise, the \fBmbstate_t\fR object pointed to by
76 76 \fIps\fR is used to completely describe the current conversion state of the
77 77 associated character sequence. The system will behave as if no function defined
78 78 in the Reference Manual calls any of these functions.
79 79 .LP
80 80 The function \fBmbsnrtowcs()\fR behaves identically to \fBmbsrtowcs()\fR,
81 81 except the conversion stops after reading \fInms\fR bytes from the
82 82 buffer pointed to by \fIsrc\fR.
83 83 .LP
84 84 The behavior of \fBmbnrtowcs()\fR and \fBmbsrtowcs()\fR functions are
85 85 affected by the \fBLC_CTYPE\fR category of the
86 86 current locale. See \fBenviron\fR(5). The functions \fBmbsrtowcs_l()\fR and
87 87 \fBmbsnrtowcs_l()\fR behave identically to \fBmbsrtowcs()\fR and
88 88 \fBmbsnrtowcs()\fR, except that instead of using the current locale, they use
89 89 the locale specified by \fIloc\fR.
90 90 .SH RETURN VALUES
91 91 .LP
92 92 If the input conversion encounters a sequence of bytes that do not form a valid
93 93 character, an encoding error occurs. In this case, these
94 94 functions store the value of the macro \fBEILSEQ\fR in \fBerrno\fR and return
95 95 \fB(size_t)\(mi1\fR; the conversion state is undefined. Otherwise, they return
96 96 the number of characters successfully converted, not including the terminating
97 97 null (if any).
98 98 .SH ERRORS
99 99 .LP
100 100 Theses functions may fail if:
101 101 .sp
102 102 .ne 2
103 103 .na
104 104 \fB\fBEINVAL\fR\fR
105 105 .ad
106 106 .RS 10n
107 107 The \fIps\fR argument points to an object that contains an invalid conversion
108 108 state.
109 109 .RE
110 110
111 111 .sp
112 112 .ne 2
113 113 .na
114 114 \fB\fBEILSEQ\fR\fR
115 115 .ad
116 116 .RS 10n
117 117 Invalid character sequence is detected.
118 118 .RE
119 119 .SH ATTRIBUTES
120 120 .LP
121 121 See \fBattributes\fR(5) for descriptions of the following attributes:
122 122 .TS
123 123 box;
124 124 c | c
125 125 l | l .
126 126 ATTRIBUTE TYPE ATTRIBUTE VALUE
127 127 _
↓ open down ↓ |
127 lines elided |
↑ open up ↑ |
128 128 Interface Stability See below.
129 129 _
130 130 MT-Level See below.
131 131 .TE
132 132
133 133 .LP
134 134 The
135 135 .B mbsnrtowcs()
136 136 and
137 137 .B mbsrtowcs()
138 -functions are Standard. The
138 +functions are Standard. The
139 139 .B mbsnrtowcs_l()
140 140 and
141 141 .B mbsrtowcs_l()
142 142 functions are Uncommitted.
143 143 .LP
144 144 If \fIps\fR is not a null pointer, these functions use the \fBmbstate_t\fR
145 145 object pointed to by \fIps\fR and can be used safely in
146 146 multithreaded applications, otherwise they use an
147 147 internal \fBmbstate_t\fR object and are Unsafe in multithreaded
148 148 applications.
149 149 .SH SEE ALSO
150 150 .LP
151 151 \fBmbrtowc\fR(3C), \fBmbsinit\fR(3C), \fBnewlocale\fR(3C),
152 152 \fBsetlocale\fR(3C), \fBuselocale()\fR, \fBattributes\fR(5),
153 153 \fBenviron\fR(5), \fBstandards\fR(5)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX