xref: /freebsd/lib/libc/iconv/iconvctl.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1ad30f8e7SGabor Kovesdan.\" Copyright (c) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
2ad30f8e7SGabor Kovesdan.\" All rights reserved.
3ad30f8e7SGabor Kovesdan.\"
4ad30f8e7SGabor Kovesdan.\" Redistribution and use in source and binary forms, with or without
5ad30f8e7SGabor Kovesdan.\" modification, are permitted provided that the following conditions
6ad30f8e7SGabor Kovesdan.\" are met:
7ad30f8e7SGabor Kovesdan.\" 1. Redistributions of source code must retain the above copyright
8ad30f8e7SGabor Kovesdan.\"    notice, this list of conditions and the following disclaimer.
9ad30f8e7SGabor Kovesdan.\" 2. Redistributions in binary form must reproduce the above copyright
10ad30f8e7SGabor Kovesdan.\"    notice, this list of conditions and the following disclaimer in the
11ad30f8e7SGabor Kovesdan.\"    documentation and/or other materials provided with the distribution.
12ad30f8e7SGabor Kovesdan.\"
13ad30f8e7SGabor Kovesdan.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14ad30f8e7SGabor Kovesdan.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15ad30f8e7SGabor Kovesdan.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16ad30f8e7SGabor Kovesdan.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17ad30f8e7SGabor Kovesdan.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18ad30f8e7SGabor Kovesdan.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19ad30f8e7SGabor Kovesdan.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20ad30f8e7SGabor Kovesdan.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21ad30f8e7SGabor Kovesdan.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22ad30f8e7SGabor Kovesdan.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23ad30f8e7SGabor Kovesdan.\" SUCH DAMAGE.
24ad30f8e7SGabor Kovesdan.\"
25ad30f8e7SGabor Kovesdan.\" Portions of this text are reprinted and reproduced in electronic form
26ad30f8e7SGabor Kovesdan.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
27ad30f8e7SGabor Kovesdan.\" Portable Operating System Interface (POSIX), The Open Group Base
28ad30f8e7SGabor Kovesdan.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
29ad30f8e7SGabor Kovesdan.\" Electrical and Electronics Engineers, Inc and The Open Group.  In the
30ad30f8e7SGabor Kovesdan.\" event of any discrepancy between this version and the original IEEE and
31ad30f8e7SGabor Kovesdan.\" The Open Group Standard, the original IEEE and The Open Group Standard is
32ad30f8e7SGabor Kovesdan.\" the referee document.  The original Standard can be obtained online at
33ad30f8e7SGabor Kovesdan.\"	http://www.opengroup.org/unix/online.html.
34ad30f8e7SGabor Kovesdan.\"
357c5b2311SHiroki Sato.Dd November 25, 2009
36ad30f8e7SGabor Kovesdan.Dt ICONVCTL 3
37ad30f8e7SGabor Kovesdan.Os
38ad30f8e7SGabor Kovesdan.Sh NAME
39ad30f8e7SGabor Kovesdan.Nm iconvctl
40ad30f8e7SGabor Kovesdan.Nd controlling and diagnostical facility for
41ad30f8e7SGabor Kovesdan.Xr iconv 3
42ad30f8e7SGabor Kovesdan.Sh LIBRARY
43ad30f8e7SGabor Kovesdan.Lb libc
44ad30f8e7SGabor Kovesdan.Sh SYNOPSIS
45ad30f8e7SGabor Kovesdan.In iconv.h
46ad30f8e7SGabor Kovesdan.Ft int
47ad30f8e7SGabor Kovesdan.Fn iconvctl "iconv_t cd" "int request" "void *argument"
48ad30f8e7SGabor Kovesdan.Sh DESCRIPTION
49ad30f8e7SGabor KovesdanThe
50ad30f8e7SGabor Kovesdan.Fn iconvctl
51ad30f8e7SGabor Kovesdanfunction can retrieve or set specific conversion
52ad30f8e7SGabor Kovesdansetting from the
53ad30f8e7SGabor Kovesdan.Fa cd
54ad30f8e7SGabor Kovesdanconversion descriptor.
55ad30f8e7SGabor KovesdanThe
56ad30f8e7SGabor Kovesdan.Fa request
57ad30f8e7SGabor Kovesdanparameter specifies the operation to accomplish and
58ad30f8e7SGabor Kovesdan.Fa argument
59ad30f8e7SGabor Kovesdanis an operation-specific argument.
60ad30f8e7SGabor Kovesdan.Pp
61ad30f8e7SGabor KovesdanThe possible operations are the following:
6246355096SJoel Dahl.Bl -tag -width indent
63ad30f8e7SGabor Kovesdan.It ICONV_TRIVIALP
64ad30f8e7SGabor KovesdanIn this case
65ad30f8e7SGabor Kovesdan.Fa argument
66ad30f8e7SGabor Kovesdanis an
67ad30f8e7SGabor Kovesdan.Ft int *
68ad30f8e7SGabor Kovesdanvariable, which is set to 1 if the encoding is trivial one, i.e.
69ad30f8e7SGabor Kovesdanthe input and output encodings are the same.
70ad30f8e7SGabor KovesdanOtherwise, the variable will be 0.
71ad30f8e7SGabor Kovesdan.It ICONV_GET_TRANSLITERATE
72ad30f8e7SGabor KovesdanDetermines if transliteration is enabled.
73ad30f8e7SGabor KovesdanThe answer is stored in
74ad30f8e7SGabor Kovesdan.Fa argument ,
75ad30f8e7SGabor Kovesdanwhich is of
76ad30f8e7SGabor Kovesdan.Ft int * .
77ad30f8e7SGabor KovesdanIt will be set to 1 if this feature is enabled or set to 0 otherwise.
78ad30f8e7SGabor Kovesdan.It ICONV_SET_TRANSLITERATE
79ad30f8e7SGabor KovesdanEnables transliteration if
80ad30f8e7SGabor Kovesdan.Fa argument ,
81ad30f8e7SGabor Kovesdanwhich is of
82ad30f8e7SGabor Kovesdan.Ft int *
83ad30f8e7SGabor Kovesdanset to 1 or disables it if
84ad30f8e7SGabor Kovesdan.Fa argument
85ad30f8e7SGabor Kovesdanis set to 0.
86ad30f8e7SGabor Kovesdan.It ICONV_GET_DISCARD_ILSEQ
87ad30f8e7SGabor KovesdanDetermines if illegal sequences are discarded or not.
88ad30f8e7SGabor KovesdanThe answer is stored in
89ad30f8e7SGabor Kovesdan.Fa argument ,
90ad30f8e7SGabor Kovesdanwhich is of
91ad30f8e7SGabor Kovesdan.Ft int * .
92ad30f8e7SGabor KovesdanIt will be set to 1 if this feature is enabled or set to 0 otherwise.
93ad30f8e7SGabor Kovesdan.It ICONV_SET_DISCARD_ILSEQ
94ad30f8e7SGabor KovesdanSets whether illegal sequences are discarded or not.
95ad30f8e7SGabor Kovesdan.Fa argument ,
96ad30f8e7SGabor Kovesdanwhich is of
97ad30f8e7SGabor Kovesdan.Ft int *
98ad30f8e7SGabor Kovesdanset to 1 or disables it if
99ad30f8e7SGabor Kovesdan.Fa argument
100ad30f8e7SGabor Kovesdanis set to 0.
101ad30f8e7SGabor Kovesdan.It ICONV_SET_HOOKS
102ad30f8e7SGabor KovesdanSets callback functions, which will be called back after successful
103ad30f8e7SGabor Kovesdanconversions.
104ad30f8e7SGabor KovesdanThe callback functions are stored in a
105ad30f8e7SGabor Kovesdan.Ft struct iconv_hooks
106ad30f8e7SGabor Kovesdanvariable, which is passed to
107ad30f8e7SGabor Kovesdan.Nm
108ad30f8e7SGabor Kovesdanvia
109ad30f8e7SGabor Kovesdan.Fa argument
110ad30f8e7SGabor Kovesdanby its address.
1117c5b2311SHiroki Sato.It ICONV_GET_ILSEQ_INVALID
1127c5b2311SHiroki SatoDetermines if a character in the input buffer that is valid,
1137c5b2311SHiroki Satobut for which an identical character does not exist in the target
1147c5b2311SHiroki Satocodeset returns
1157c5b2311SHiroki Sato.Er EILSEQ
1167c5b2311SHiroki Satoor not.
1177c5b2311SHiroki SatoThe answer is stored in
1187c5b2311SHiroki Sato.Fa argument ,
1197c5b2311SHiroki Satowhich is of
1207c5b2311SHiroki Sato.Ft int * .
1217c5b2311SHiroki SatoIt will be set to 1 if this feature is enabled or set to 0 otherwise.
1227c5b2311SHiroki Sato.It ICONV_SET_ILSEQ_INVALID
1237c5b2311SHiroki SatoSets whether a character in the input buffer that is valid,
1247c5b2311SHiroki Satobut for which an identical character does not exist in the target
1257c5b2311SHiroki Satocodeset returns
1267c5b2311SHiroki Sato.Er EILSEQ
1277c5b2311SHiroki Satoor not.
1287c5b2311SHiroki SatoIf
1297c5b2311SHiroki Sato.Fa argument ,
1307c5b2311SHiroki Satowhich is of
1317c5b2311SHiroki Sato.Ft int *
1327c5b2311SHiroki Satois set to 1 it will be enabled,
1337c5b2311SHiroki Satoand if
1347c5b2311SHiroki Sato.Fa argument
1357c5b2311SHiroki Satois set to 0 it will be disabled.
136539617ecSJoel Dahl.El
137ad30f8e7SGabor Kovesdan.\" XXX: fallbacks are unimplemented and trying to set them will always
138ad30f8e7SGabor Kovesdan.\"      return EOPNOTSUPP but definitions are provided for source-level
139ad30f8e7SGabor Kovesdan.\"      compatibility.
140ad30f8e7SGabor Kovesdan.\".It ICONV_SET_FALLBACKS
141ad30f8e7SGabor Kovesdan.\"Sets callback functions, which will be called back after failed
142ad30f8e7SGabor Kovesdan.\"conversions.
143ad30f8e7SGabor Kovesdan.\"The callback functions are stored in a
144ad30f8e7SGabor Kovesdan.\".Ft struct iconv_fallbacks
145ad30f8e7SGabor Kovesdan.\"variable, which is passed to
146ad30f8e7SGabor Kovesdan.\".Nm
147ad30f8e7SGabor Kovesdan.\"via
148ad30f8e7SGabor Kovesdan.\".Fa argument
149ad30f8e7SGabor Kovesdan.\"by its address.
150ad30f8e7SGabor Kovesdan.Sh RETURN VALUES
151ad30f8e7SGabor KovesdanUpon successful completion
152ad30f8e7SGabor Kovesdan.Fn iconvctl ,
153ad30f8e7SGabor Kovesdanreturns 0.
154ad30f8e7SGabor KovesdanOtherwise, \-1 is returned and errno is set to
155ad30f8e7SGabor Kovesdanspecify the kind of error.
156ad30f8e7SGabor Kovesdan.Sh ERRORS
157ad30f8e7SGabor KovesdanThe
158ad30f8e7SGabor Kovesdan.Fn iconvctl
159ad30f8e7SGabor Kovesdanfunction may cause an error in the following cases:
160ad30f8e7SGabor Kovesdan.Bl -tag -width Er
161ad30f8e7SGabor Kovesdan.It Bq Er EINVAL
162ad30f8e7SGabor KovesdanUnknown or unimplemented operation.
163ad30f8e7SGabor Kovesdan.It Bq Er EBADF
164ad30f8e7SGabor KovesdanThe conversion descriptor specified by
165ad30f8e7SGabor Kovesdan.Fa cd
166ad30f8e7SGabor Kovesdanis invalid.
167539617ecSJoel Dahl.El
168ad30f8e7SGabor Kovesdan.Sh SEE ALSO
169ad30f8e7SGabor Kovesdan.Xr iconv 1 ,
170ad30f8e7SGabor Kovesdan.Xr iconv 3
171ad30f8e7SGabor Kovesdan.Sh STANDARDS
172ad30f8e7SGabor KovesdanThe
173ad30f8e7SGabor Kovesdan.Nm
174ad30f8e7SGabor Kovesdanfacility is a non-standard extension, which appeared in
175ad30f8e7SGabor Kovesdanthe GNU implementation and was adopted in
176d7d8b00bSUlrich Spörlein.Fx 9.0
177ad30f8e7SGabor Kovesdanfor compatibility's sake.
178135bce2aSUlrich Spörlein.Sh AUTHORS
179135bce2aSUlrich SpörleinThis manual page was written by
180*8fbf3d50SBaptiste Daroussin.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
181ad30f8e7SGabor Kovesdan.Sh BUGS
182ad30f8e7SGabor KovesdanTransliteration is enabled in this implementation by default, so it
183ad30f8e7SGabor Kovesdanis impossible by design to turn it off.
184ad30f8e7SGabor KovesdanAccordingly, trying to turn it off will always fail and \-1 will be
185ad30f8e7SGabor Kovesdanreturned.
186ad30f8e7SGabor KovesdanGetting the transliteration state will always succeed and indicate
187ad30f8e7SGabor Kovesdanthat it is turned on, though.
188