Commit | Line | Data |
---|---|---|
0d5acd74 JM |
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 | .\" $FreeBSD: head/lib/libc/iconv/iconvctl.3 233577 2012-03-27 20:50:14Z joel $ | |
36 | .\" | |
9d944071 | 37 | .Dd January 9, 2014 |
0d5acd74 JM |
38 | .Dt ICONVCTL 3 |
39 | .Os | |
40 | .Sh NAME | |
41 | .Nm iconvctl | |
42 | .Nd controlling and diagnostical facility for | |
43 | .Xr iconv 3 | |
44 | .Sh LIBRARY | |
45 | .Lb libc | |
46 | .Sh SYNOPSIS | |
47 | .In iconv.h | |
48 | .Ft int | |
49 | .Fn iconvctl "iconv_t cd" "int request" "void *argument" | |
50 | .Sh DESCRIPTION | |
51 | The | |
52 | .Fn iconvctl | |
53 | function can retrieve or set specific conversion | |
54 | setting from the | |
55 | .Fa cd | |
56 | conversion descriptor. | |
57 | The | |
58 | .Fa request | |
59 | parameter specifies the operation to accomplish and | |
60 | .Fa argument | |
61 | is an operation-specific argument. | |
62 | .Pp | |
63 | The possible operations are the following: | |
64 | .Bl -tag -width indent | |
4ca2ad27 | 65 | .It Dv ICONV_TRIVIALP |
0d5acd74 JM |
66 | In this case |
67 | .Fa argument | |
68 | is an | |
69 | .Ft int * | |
70 | variable, which is set to 1 if the encoding is trivial one, i.e. | |
71 | the input and output encodings are the same. | |
72 | Otherwise, the variable will be 0. | |
4ca2ad27 | 73 | .It Dv ICONV_GET_TRANSLITERATE |
0d5acd74 JM |
74 | Determines if transliteration is enabled. |
75 | The answer is stored in | |
76 | .Fa argument , | |
77 | which is of | |
78 | .Ft int * . | |
79 | It will be set to 1 if this feature is enabled or set to 0 otherwise. | |
4ca2ad27 | 80 | .It Dv ICONV_SET_TRANSLITERATE |
0d5acd74 JM |
81 | Enables transliteration if |
82 | .Fa argument , | |
83 | which is of | |
84 | .Ft int * | |
85 | set to 1 or disables it if | |
86 | .Fa argument | |
87 | is set to 0. | |
4ca2ad27 | 88 | .It Dv ICONV_GET_DISCARD_ILSEQ |
0d5acd74 JM |
89 | Determines if illegal sequences are discarded or not. |
90 | The answer is stored in | |
91 | .Fa argument , | |
92 | which is of | |
93 | .Ft int * . | |
94 | It will be set to 1 if this feature is enabled or set to 0 otherwise. | |
4ca2ad27 | 95 | .It Dv ICONV_SET_DISCARD_ILSEQ |
0d5acd74 JM |
96 | Sets whether illegal sequences are discarded or not. |
97 | .Fa argument , | |
98 | which is of | |
99 | .Ft int * | |
100 | set to 1 or disables it if | |
101 | .Fa argument | |
102 | is set to 0. | |
4ca2ad27 | 103 | .It Dv ICONV_SET_HOOKS |
0d5acd74 JM |
104 | Sets callback functions, which will be called back after successful |
105 | conversions. | |
106 | The callback functions are stored in a | |
107 | .Ft struct iconv_hooks | |
108 | variable, which is passed to | |
109 | .Nm | |
110 | via | |
111 | .Fa argument | |
112 | by its address. | |
4ca2ad27 | 113 | .It Dv ICONV_GET_ILSEQ_INVALID |
9d944071 JM |
114 | Determines if a character in the input buffer that is valid, |
115 | but for which an identical character does not exist in the target | |
116 | codeset returns | |
117 | .Er EILSEQ | |
118 | or not. | |
119 | The answer is stored in | |
120 | .Fa argument , | |
121 | which is of | |
122 | .Ft int * . | |
123 | It will be set to 1 if this feature is enabled or set to 0 otherwise. | |
4ca2ad27 | 124 | .It Dv ICONV_SET_ILSEQ_INVALID |
9d944071 JM |
125 | Sets whether a character in the input buffer that is valid, |
126 | but for which an identical character does not exist in the target | |
127 | codeset returns | |
128 | .Er EILSEQ | |
129 | or not. | |
130 | If | |
131 | .Fa argument , | |
132 | which is of | |
133 | .Ft int * | |
134 | is set to 1 it will be enabled, | |
135 | and if | |
136 | .Fa argument | |
137 | is set to 0 it will be disabled. | |
0d5acd74 JM |
138 | .El |
139 | .\" XXX: fallbacks are unimplemented and trying to set them will always | |
140 | .\" return EOPNOTSUPP but definitions are provided for source-level | |
141 | .\" compatibility. | |
4ca2ad27 | 142 | .\".It Dv ICONV_SET_FALLBACKS |
0d5acd74 JM |
143 | .\"Sets callback functions, which will be called back after failed |
144 | .\"conversions. | |
145 | .\"The callback functions are stored in a | |
146 | .\".Ft struct iconv_fallbacks | |
147 | .\"variable, which is passed to | |
148 | .\".Nm | |
149 | .\"via | |
150 | .\".Fa argument | |
151 | .\"by its address. | |
152 | .Sh RETURN VALUES | |
153 | Upon successful completion | |
154 | .Fn iconvctl , | |
155 | returns 0. | |
156 | Otherwise, \-1 is returned and errno is set to | |
157 | specify the kind of error. | |
158 | .Sh ERRORS | |
159 | The | |
160 | .Fn iconvctl | |
161 | function may cause an error in the following cases: | |
162 | .Bl -tag -width Er | |
163 | .It Bq Er EINVAL | |
164 | Unknown or unimplemented operation. | |
165 | .It Bq Er EBADF | |
166 | The conversion descriptor specified by | |
167 | .Fa cd | |
168 | is invalid. | |
169 | .El | |
170 | .Sh SEE ALSO | |
171 | .Xr iconv 1 , | |
172 | .Xr iconv 3 | |
173 | .Sh STANDARDS | |
174 | The | |
175 | .Nm | |
176 | facility is a non-standard extension, which appeared in | |
177 | the GNU implementation and was adopted in | |
d118ff3c | 178 | .Fx 9.0 |
0d5acd74 JM |
179 | for compatibility's sake. |
180 | .Sh AUTHORS | |
181 | This manual page was written by | |
d118ff3c | 182 | .An Gabor Kovesdan Aq Mt gabor@FreeBSD.org . |
0d5acd74 JM |
183 | .Sh BUGS |
184 | Transliteration is enabled in this implementation by default, so it | |
185 | is impossible by design to turn it off. | |
186 | Accordingly, trying to turn it off will always fail and \-1 will be | |
187 | returned. | |
188 | Getting the transliteration state will always succeed and indicate | |
189 | that it is turned on, though. |