]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/iconv/iconvctl.3
Remove $FreeBSD$: two-line nroff pattern
[FreeBSD/FreeBSD.git] / lib / libc / iconv / iconvctl.3
1 .\" Copyright (c) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" Portions of this text are reprinted and reproduced in electronic form
26 .\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
27 .\" Portable Operating System Interface (POSIX), The Open Group Base
28 .\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
29 .\" Electrical and Electronics Engineers, Inc and The Open Group.  In the
30 .\" event of any discrepancy between this version and the original IEEE and
31 .\" The Open Group Standard, the original IEEE and The Open Group Standard is
32 .\" the referee document.  The original Standard can be obtained online at
33 .\"     http://www.opengroup.org/unix/online.html.
34 .\"
35 .Dd November 25, 2009
36 .Dt ICONVCTL 3
37 .Os
38 .Sh NAME
39 .Nm iconvctl
40 .Nd controlling and diagnostical facility for
41 .Xr iconv 3
42 .Sh LIBRARY
43 .Lb libc
44 .Sh SYNOPSIS
45 .In iconv.h
46 .Ft int
47 .Fn iconvctl "iconv_t cd" "int request" "void *argument"
48 .Sh DESCRIPTION
49 The
50 .Fn iconvctl
51 function can retrieve or set specific conversion
52 setting from the
53 .Fa cd
54 conversion descriptor.
55 The
56 .Fa request
57 parameter specifies the operation to accomplish and
58 .Fa argument
59 is an operation-specific argument.
60 .Pp
61 The possible operations are the following:
62 .Bl -tag -width indent
63 .It ICONV_TRIVIALP
64 In this case
65 .Fa argument
66 is an
67 .Ft int *
68 variable, which is set to 1 if the encoding is trivial one, i.e.
69 the input and output encodings are the same.
70 Otherwise, the variable will be 0.
71 .It ICONV_GET_TRANSLITERATE
72 Determines if transliteration is enabled.
73 The answer is stored in
74 .Fa argument ,
75 which is of
76 .Ft int * .
77 It will be set to 1 if this feature is enabled or set to 0 otherwise.
78 .It ICONV_SET_TRANSLITERATE
79 Enables transliteration if
80 .Fa argument ,
81 which is of
82 .Ft int *
83 set to 1 or disables it if
84 .Fa argument
85 is set to 0.
86 .It ICONV_GET_DISCARD_ILSEQ
87 Determines if illegal sequences are discarded or not.
88 The answer is stored in
89 .Fa argument ,
90 which is of
91 .Ft int * .
92 It will be set to 1 if this feature is enabled or set to 0 otherwise.
93 .It ICONV_SET_DISCARD_ILSEQ
94 Sets whether illegal sequences are discarded or not.
95 .Fa argument ,
96 which is of
97 .Ft int *
98 set to 1 or disables it if
99 .Fa argument
100 is set to 0.
101 .It ICONV_SET_HOOKS
102 Sets callback functions, which will be called back after successful
103 conversions.
104 The callback functions are stored in a
105 .Ft struct iconv_hooks
106 variable, which is passed to
107 .Nm
108 via
109 .Fa argument
110 by its address.
111 .It ICONV_GET_ILSEQ_INVALID
112 Determines if a character in the input buffer that is valid,
113 but for which an identical character does not exist in the target
114 codeset returns
115 .Er EILSEQ
116 or not.
117 The answer is stored in
118 .Fa argument ,
119 which is of
120 .Ft int * .
121 It will be set to 1 if this feature is enabled or set to 0 otherwise.
122 .It ICONV_SET_ILSEQ_INVALID
123 Sets whether a character in the input buffer that is valid,
124 but for which an identical character does not exist in the target
125 codeset returns
126 .Er EILSEQ
127 or not.
128 If
129 .Fa argument ,
130 which is of
131 .Ft int *
132 is set to 1 it will be enabled,
133 and if
134 .Fa argument
135 is set to 0 it will be disabled.
136 .El
137 .\" XXX: fallbacks are unimplemented and trying to set them will always
138 .\"      return EOPNOTSUPP but definitions are provided for source-level
139 .\"      compatibility.
140 .\".It ICONV_SET_FALLBACKS
141 .\"Sets callback functions, which will be called back after failed
142 .\"conversions.
143 .\"The callback functions are stored in a
144 .\".Ft struct iconv_fallbacks
145 .\"variable, which is passed to
146 .\".Nm
147 .\"via
148 .\".Fa argument
149 .\"by its address.
150 .Sh RETURN VALUES
151 Upon successful completion
152 .Fn iconvctl ,
153 returns 0.
154 Otherwise, \-1 is returned and errno is set to
155 specify the kind of error.
156 .Sh ERRORS
157 The
158 .Fn iconvctl
159 function may cause an error in the following cases:
160 .Bl -tag -width Er
161 .It Bq Er EINVAL
162 Unknown or unimplemented operation.
163 .It Bq Er EBADF
164 The conversion descriptor specified by
165 .Fa cd
166 is invalid.
167 .El
168 .Sh SEE ALSO
169 .Xr iconv 1 ,
170 .Xr iconv 3
171 .Sh STANDARDS
172 The
173 .Nm
174 facility is a non-standard extension, which appeared in
175 the GNU implementation and was adopted in
176 .Fx 9.0
177 for compatibility's sake.
178 .Sh AUTHORS
179 This manual page was written by
180 .An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
181 .Sh BUGS
182 Transliteration is enabled in this implementation by default, so it
183 is impossible by design to turn it off.
184 Accordingly, trying to turn it off will always fail and \-1 will be
185 returned.
186 Getting the transliteration state will always succeed and indicate
187 that it is turned on, though.