.\" The Regents of the University of California. All rights reserved.
.\" This code is derived from software contributed to Berkeley by
.\" Paul Borman at Krystal Technologies.
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" @(#)rune.3 8.1 (Berkeley) 6/27/93
.Fn setrunelocale "char *locale"
.Fn setinvalidrune "rune_t rune"
.Fn sgetrune "const char *string" "size_t n" "char const **result"
.Fn sputrune "rune_t rune" "char *string" "size_t n" "char **result"
.Fn fgetrune "FILE *stream"
.Fn fungetrune "rune_t rune" "FILE *stream"
.Fn fputrune "rune_t rune" "FILE *stream"
controls the type of encoding used to represent runes as multibyte strings
as well as the properties of the runes as defined in
argument indicates the locale which to load.
If the locale is successfully loaded,
is returned, otherwise an errno value is returned to indicate the
function sets the value of the global value
function tries to read a single multibyte character from
is successful, the rune is returned.
will point to the first byte which was not converted in
do not describe a full multibyte character,
If there is an encoding error at the start of
will point to the second character of
as a multibyte string and store it at
will be set to point to the first byte in string following the new
is the number of bytes that would be needed to store the multibyte value.
If the multibyte character would consist of more than
will return the number of bytes which would be needed to store
as a multibyte character.
function operates the same as
with the exception that it attempts to read enough bytes from
to decode a single rune. It returns either
on an encoding error, or the rune decoded if all went well.
function function pushes the multibyte encoding, as provided by
function writes the multibyte encoding of
function returns one of the following values:
.Fa setrunelocale was successful.
The locale could not be found.
The file found was not a valid file.
The encoding indicated by the locale was unknown.
function either returns the rune read or
function returns the number of bytes needed to store
.Bl -tag -width /usr/share/locale/locale/LC_CTYPE -compact
.It Pa $PATH_LOCALE/\fIlocale\fP/LC_CTYPE
.It Pa /usr/share/locale/\fIlocale\fP/LC_CTYPE
binary LC_CTYPE file for the locale \fIlocale\fP.
was chosen to accent the purposeful choice of not basing the
primitives, which were, shall we say, less aesthetic.
These functions first appeared in
function and the other non-ANSI rune functions were inspired by
.Nm Plan 9 from Bell Labs
as a much more sane alternative to the ANSI multibyte and
.\"They were conceived at the San Diego 1993 Summer USENIX conference by
.\"Paul Borman of Krystal Technologies, Keith Bostic of CSRG and Andrew Hume
All of the ANSI multibyte and wide character
support functions are built using the rune functions.