xref: /dflybsd-src/lib/libc/iconv/iconvctl.3 (revision 4ca2ad2717ad6660cf122bb0fbc4ebeaeed6e638)
10d5acd74SJohn Marino.\" Copyright (c) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
20d5acd74SJohn Marino.\" All rights reserved.
30d5acd74SJohn Marino.\"
40d5acd74SJohn Marino.\" Redistribution and use in source and binary forms, with or without
50d5acd74SJohn Marino.\" modification, are permitted provided that the following conditions
60d5acd74SJohn Marino.\" are met:
70d5acd74SJohn Marino.\" 1. Redistributions of source code must retain the above copyright
80d5acd74SJohn Marino.\"    notice, this list of conditions and the following disclaimer.
90d5acd74SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright
100d5acd74SJohn Marino.\"    notice, this list of conditions and the following disclaimer in the
110d5acd74SJohn Marino.\"    documentation and/or other materials provided with the distribution.
120d5acd74SJohn Marino.\"
130d5acd74SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
140d5acd74SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
150d5acd74SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
160d5acd74SJohn Marino.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
170d5acd74SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
180d5acd74SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
190d5acd74SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
200d5acd74SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
210d5acd74SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
220d5acd74SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
230d5acd74SJohn Marino.\" SUCH DAMAGE.
240d5acd74SJohn Marino.\"
250d5acd74SJohn Marino.\" Portions of this text are reprinted and reproduced in electronic form
260d5acd74SJohn Marino.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
270d5acd74SJohn Marino.\" Portable Operating System Interface (POSIX), The Open Group Base
280d5acd74SJohn Marino.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
290d5acd74SJohn Marino.\" Electrical and Electronics Engineers, Inc and The Open Group.  In the
300d5acd74SJohn Marino.\" event of any discrepancy between this version and the original IEEE and
310d5acd74SJohn Marino.\" The Open Group Standard, the original IEEE and The Open Group Standard is
320d5acd74SJohn Marino.\" the referee document.  The original Standard can be obtained online at
330d5acd74SJohn Marino.\"	http://www.opengroup.org/unix/online.html.
340d5acd74SJohn Marino.\"
350d5acd74SJohn Marino.\" $FreeBSD: head/lib/libc/iconv/iconvctl.3 233577 2012-03-27 20:50:14Z joel $
360d5acd74SJohn Marino.\"
379d944071SJohn Marino.Dd January 9, 2014
380d5acd74SJohn Marino.Dt ICONVCTL 3
390d5acd74SJohn Marino.Os
400d5acd74SJohn Marino.Sh NAME
410d5acd74SJohn Marino.Nm iconvctl
420d5acd74SJohn Marino.Nd controlling and diagnostical facility for
430d5acd74SJohn Marino.Xr iconv 3
440d5acd74SJohn Marino.Sh LIBRARY
450d5acd74SJohn Marino.Lb libc
460d5acd74SJohn Marino.Sh SYNOPSIS
470d5acd74SJohn Marino.In iconv.h
480d5acd74SJohn Marino.Ft int
490d5acd74SJohn Marino.Fn iconvctl "iconv_t cd" "int request" "void *argument"
500d5acd74SJohn Marino.Sh DESCRIPTION
510d5acd74SJohn MarinoThe
520d5acd74SJohn Marino.Fn iconvctl
530d5acd74SJohn Marinofunction can retrieve or set specific conversion
540d5acd74SJohn Marinosetting from the
550d5acd74SJohn Marino.Fa cd
560d5acd74SJohn Marinoconversion descriptor.
570d5acd74SJohn MarinoThe
580d5acd74SJohn Marino.Fa request
590d5acd74SJohn Marinoparameter specifies the operation to accomplish and
600d5acd74SJohn Marino.Fa argument
610d5acd74SJohn Marinois an operation-specific argument.
620d5acd74SJohn Marino.Pp
630d5acd74SJohn MarinoThe possible operations are the following:
640d5acd74SJohn Marino.Bl -tag -width indent
65*4ca2ad27SSascha Wildner.It Dv ICONV_TRIVIALP
660d5acd74SJohn MarinoIn this case
670d5acd74SJohn Marino.Fa argument
680d5acd74SJohn Marinois an
690d5acd74SJohn Marino.Ft int *
700d5acd74SJohn Marinovariable, which is set to 1 if the encoding is trivial one, i.e.
710d5acd74SJohn Marinothe input and output encodings are the same.
720d5acd74SJohn MarinoOtherwise, the variable will be 0.
73*4ca2ad27SSascha Wildner.It Dv ICONV_GET_TRANSLITERATE
740d5acd74SJohn MarinoDetermines if transliteration is enabled.
750d5acd74SJohn MarinoThe answer is stored in
760d5acd74SJohn Marino.Fa argument ,
770d5acd74SJohn Marinowhich is of
780d5acd74SJohn Marino.Ft int * .
790d5acd74SJohn MarinoIt will be set to 1 if this feature is enabled or set to 0 otherwise.
80*4ca2ad27SSascha Wildner.It Dv ICONV_SET_TRANSLITERATE
810d5acd74SJohn MarinoEnables transliteration if
820d5acd74SJohn Marino.Fa argument ,
830d5acd74SJohn Marinowhich is of
840d5acd74SJohn Marino.Ft int *
850d5acd74SJohn Marinoset to 1 or disables it if
860d5acd74SJohn Marino.Fa argument
870d5acd74SJohn Marinois set to 0.
88*4ca2ad27SSascha Wildner.It Dv ICONV_GET_DISCARD_ILSEQ
890d5acd74SJohn MarinoDetermines if illegal sequences are discarded or not.
900d5acd74SJohn MarinoThe answer is stored in
910d5acd74SJohn Marino.Fa argument ,
920d5acd74SJohn Marinowhich is of
930d5acd74SJohn Marino.Ft int * .
940d5acd74SJohn MarinoIt will be set to 1 if this feature is enabled or set to 0 otherwise.
95*4ca2ad27SSascha Wildner.It Dv ICONV_SET_DISCARD_ILSEQ
960d5acd74SJohn MarinoSets whether illegal sequences are discarded or not.
970d5acd74SJohn Marino.Fa argument ,
980d5acd74SJohn Marinowhich is of
990d5acd74SJohn Marino.Ft int *
1000d5acd74SJohn Marinoset to 1 or disables it if
1010d5acd74SJohn Marino.Fa argument
1020d5acd74SJohn Marinois set to 0.
103*4ca2ad27SSascha Wildner.It Dv ICONV_SET_HOOKS
1040d5acd74SJohn MarinoSets callback functions, which will be called back after successful
1050d5acd74SJohn Marinoconversions.
1060d5acd74SJohn MarinoThe callback functions are stored in a
1070d5acd74SJohn Marino.Ft struct iconv_hooks
1080d5acd74SJohn Marinovariable, which is passed to
1090d5acd74SJohn Marino.Nm
1100d5acd74SJohn Marinovia
1110d5acd74SJohn Marino.Fa argument
1120d5acd74SJohn Marinoby its address.
113*4ca2ad27SSascha Wildner.It Dv ICONV_GET_ILSEQ_INVALID
1149d944071SJohn MarinoDetermines if a character in the input buffer that is valid,
1159d944071SJohn Marinobut for which an identical character does not exist in the target
1169d944071SJohn Marinocodeset returns
1179d944071SJohn Marino.Er EILSEQ
1189d944071SJohn Marinoor not.
1199d944071SJohn MarinoThe answer is stored in
1209d944071SJohn Marino.Fa argument ,
1219d944071SJohn Marinowhich is of
1229d944071SJohn Marino.Ft int * .
1239d944071SJohn MarinoIt will be set to 1 if this feature is enabled or set to 0 otherwise.
124*4ca2ad27SSascha Wildner.It Dv ICONV_SET_ILSEQ_INVALID
1259d944071SJohn MarinoSets whether a character in the input buffer that is valid,
1269d944071SJohn Marinobut for which an identical character does not exist in the target
1279d944071SJohn Marinocodeset returns
1289d944071SJohn Marino.Er EILSEQ
1299d944071SJohn Marinoor not.
1309d944071SJohn MarinoIf
1319d944071SJohn Marino.Fa argument ,
1329d944071SJohn Marinowhich is of
1339d944071SJohn Marino.Ft int *
1349d944071SJohn Marinois set to 1 it will be enabled,
1359d944071SJohn Marinoand if
1369d944071SJohn Marino.Fa argument
1379d944071SJohn Marinois set to 0 it will be disabled.
1380d5acd74SJohn Marino.El
1390d5acd74SJohn Marino.\" XXX: fallbacks are unimplemented and trying to set them will always
1400d5acd74SJohn Marino.\"      return EOPNOTSUPP but definitions are provided for source-level
1410d5acd74SJohn Marino.\"      compatibility.
142*4ca2ad27SSascha Wildner.\".It Dv ICONV_SET_FALLBACKS
1430d5acd74SJohn Marino.\"Sets callback functions, which will be called back after failed
1440d5acd74SJohn Marino.\"conversions.
1450d5acd74SJohn Marino.\"The callback functions are stored in a
1460d5acd74SJohn Marino.\".Ft struct iconv_fallbacks
1470d5acd74SJohn Marino.\"variable, which is passed to
1480d5acd74SJohn Marino.\".Nm
1490d5acd74SJohn Marino.\"via
1500d5acd74SJohn Marino.\".Fa argument
1510d5acd74SJohn Marino.\"by its address.
1520d5acd74SJohn Marino.Sh RETURN VALUES
1530d5acd74SJohn MarinoUpon successful completion
1540d5acd74SJohn Marino.Fn iconvctl ,
1550d5acd74SJohn Marinoreturns 0.
1560d5acd74SJohn MarinoOtherwise, \-1 is returned and errno is set to
1570d5acd74SJohn Marinospecify the kind of error.
1580d5acd74SJohn Marino.Sh ERRORS
1590d5acd74SJohn MarinoThe
1600d5acd74SJohn Marino.Fn iconvctl
1610d5acd74SJohn Marinofunction may cause an error in the following cases:
1620d5acd74SJohn Marino.Bl -tag -width Er
1630d5acd74SJohn Marino.It Bq Er EINVAL
1640d5acd74SJohn MarinoUnknown or unimplemented operation.
1650d5acd74SJohn Marino.It Bq Er EBADF
1660d5acd74SJohn MarinoThe conversion descriptor specified by
1670d5acd74SJohn Marino.Fa cd
1680d5acd74SJohn Marinois invalid.
1690d5acd74SJohn Marino.El
1700d5acd74SJohn Marino.Sh SEE ALSO
1710d5acd74SJohn Marino.Xr iconv 1 ,
1720d5acd74SJohn Marino.Xr iconv 3
1730d5acd74SJohn Marino.Sh STANDARDS
1740d5acd74SJohn MarinoThe
1750d5acd74SJohn Marino.Nm
1760d5acd74SJohn Marinofacility is a non-standard extension, which appeared in
1770d5acd74SJohn Marinothe GNU implementation and was adopted in
178d118ff3cSFranco Fichtner.Fx 9.0
1790d5acd74SJohn Marinofor compatibility's sake.
1800d5acd74SJohn Marino.Sh AUTHORS
1810d5acd74SJohn MarinoThis manual page was written by
182d118ff3cSFranco Fichtner.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
1830d5acd74SJohn Marino.Sh BUGS
1840d5acd74SJohn MarinoTransliteration is enabled in this implementation by default, so it
1850d5acd74SJohn Marinois impossible by design to turn it off.
1860d5acd74SJohn MarinoAccordingly, trying to turn it off will always fail and \-1 will be
1870d5acd74SJohn Marinoreturned.
1880d5acd74SJohn MarinoGetting the transliteration state will always succeed and indicate
1890d5acd74SJohn Marinothat it is turned on, though.
190