2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Paul Borman at Krystal Technologies.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\" notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\" notice, this list of conditions and the following disclaimer in the
14 .\" documentation and/or other materials provided with the distribution.
15 .\" 3. All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\" This product includes software developed by the University of
18 .\" California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\" may be used to endorse or promote products derived from this software
21 .\" without specific prior written permission.
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .\" @(#)rune.3 8.2 (Berkeley) 12/11/93
36 .\" $FreeBSD: src/lib/libc/locale/rune.3,v 1.10.2.7 2002/08/07 06:24:14 ache Exp $
37 .\" $DragonFly: src/lib/libc/locale/Attic/rune.3,v 1.2 2003/06/17 04:26:44 dillon Exp $
50 .Nd rune support for C
57 .Fn setrunelocale "char *locale"
59 .Fn setinvalidrune "rune_t rune"
61 .Fn sgetrune "const char *string" "size_t n" "char const **result"
63 .Fn sputrune "rune_t rune" "char *string" "size_t n" "char **result"
67 .Fn fgetrune "FILE *stream"
69 .Fn fungetrune "rune_t rune" "FILE *stream"
71 .Fn fputrune "rune_t rune" "FILE *stream"
75 controls the type of encoding used to represent runes as multibyte strings
76 as well as the properties of the runes as defined in
80 argument indicates which locale to load.
81 If the locale is successfully loaded,
83 is returned, otherwise an errno value is returned to indicate the
88 function sets the value of the global value
95 function tries to read a single multibyte character from
102 is successful, the rune is returned.
108 will point to the first byte which was not converted in
114 do not describe a full multibyte character,
120 If there is an encoding error at the start of
125 will point to the second character of
130 function tries to encode
132 as a multibyte string and store it at
136 bytes will be stored.
142 will be set to point to the first byte in string following the new
154 is the number of bytes that would be needed to store the multibyte value.
155 If the multibyte character would consist of more than
166 will return the number of bytes which would be needed to store
168 as a multibyte character.
172 function operates the same as
174 with the exception that it attempts to read enough bytes from
176 to decode a single rune. It returns either
180 on an encoding error, or the rune decoded if all went well.
184 function pushes the multibyte encoding, as provided by
202 function writes the multibyte encoding of
216 function returns one of the following values:
225 The locale could not be found.
227 The file found was not a valid file.
232 function either returns the rune read or
236 function returns the number of bytes needed to store
238 as a multibyte string.
240 .Bl -tag -width /usr/share/locale/locale/LC_CTYPE -compact
241 .It Pa $PATH_LOCALE/ Ns Em locale Ns /LC_CTYPE
242 .It Pa /usr/share/locale/ Ns Em locale Ns /LC_CTYPE
243 binary LC_CTYPE file for the locale
257 was chosen to accent the purposeful choice of not basing the
258 system with the ANSI C
259 primitives, which were, shall we say, less aesthetic.
261 These functions first appeared in
266 function and the other non-ANSI rune functions were inspired by
267 .Sy "Plan 9 from Bell Labs"
268 as a much more sane alternative to the ANSI multibyte and
269 wide character support.
270 .\"They were conceived at the San Diego 1993 Summer USENIX conference by
271 .\"Paul Borman of Krystal Technologies, Keith Bostic of CSRG and Andrew Hume
274 All of the ANSI multibyte and wide character
275 support functions are built using the rune functions.