aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/locale
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2004-10-17 06:51:50 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2004-10-17 06:51:50 +0000
commit31d330fb2aee652cc96eafb65787c34dfe501554 (patch)
treea3bffb22a76a3f22042392ea278a1a75e2be4f90 /lib/libc/locale
parentffea66bce55a1f5de9df8b9a3f92ca8a63a3012d (diff)
downloadsrc-31d330fb2aee652cc96eafb65787c34dfe501554.tar.gz
src-31d330fb2aee652cc96eafb65787c34dfe501554.zip
Remove the obsolete <rune.h> interface.
Notes
Notes: svn path=/head/; revision=136609
Diffstat (limited to 'lib/libc/locale')
-rw-r--r--lib/libc/locale/Makefile.inc13
-rw-r--r--lib/libc/locale/frune.c83
-rw-r--r--lib/libc/locale/mblocal.h8
-rw-r--r--lib/libc/locale/mbrune.3174
-rw-r--r--lib/libc/locale/mbrune.c120
-rw-r--r--lib/libc/locale/rune.3282
-rw-r--r--lib/libc/locale/setinvalidrune.c51
-rw-r--r--lib/libc/locale/setlocale.311
-rw-r--r--lib/libc/locale/setrunelocale.c6
-rw-r--r--lib/libc/locale/srune.c105
-rw-r--r--lib/libc/locale/table.c4
11 files changed, 11 insertions, 846 deletions
diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc
index 260d1962b15b..62ecd327541d 100644
--- a/lib/libc/locale/Makefile.inc
+++ b/lib/libc/locale/Makefile.inc
@@ -4,14 +4,14 @@
# locale sources
.PATH: ${.CURDIR}/${MACHINE_ARCH}/locale ${.CURDIR}/locale
-SRCS+= big5.c btowc.c collate.c collcmp.c euc.c fix_grouping.c frune.c \
+SRCS+= big5.c btowc.c collate.c collcmp.c euc.c fix_grouping.c \
gb18030.c gb2312.c gbk.c isctype.c iswctype.c \
ldpart.c lmessages.c lmonetary.c lnumeric.c localeconv.c mblen.c \
mbrlen.c \
- mbrtowc.c mbrune.c mbsinit.c mbsnrtowcs.c \
+ mbrtowc.c mbsinit.c mbsnrtowcs.c \
mbsrtowcs.c mbtowc.c mbstowcs.c \
mskanji.c nextwctype.c nl_langinfo.c nomacros.c none.c rune.c \
- runetype.c setinvalidrune.c setlocale.c setrunelocale.c srune.c \
+ runetype.c setlocale.c setrunelocale.c \
table.c \
tolower.c toupper.c utf8.c wcrtomb.c wcsnrtombs.c \
wcsrtombs.c wcsftime.c \
@@ -27,10 +27,9 @@ MAN+= btowc.3 \
ispunct.3 isrune.3 isspace.3 isspecial.3 \
isupper.3 iswalnum.3 isxdigit.3 localeconv.3 mblen.3 mbrlen.3 \
mbrtowc.3 \
- mbrune.3 mbsinit.3 \
+ mbsinit.3 \
mbsrtowcs.3 mbstowcs.3 mbtowc.3 multibyte.3 \
nextwctype.3 nl_langinfo.3 \
- rune.3 \
setlocale.3 toascii.3 tolower.3 toupper.3 towlower.3 towupper.3 \
wcsftime.3 \
wcrtomb.3 \
@@ -48,11 +47,7 @@ MLINKS+=iswalnum.3 iswalpha.3 iswalnum.3 iswascii.3 iswalnum.3 iswblank.3 \
iswalnum.3 iswrune.3 iswalnum.3 iswspace.3 iswalnum.3 iswspecial.3 \
iswalnum.3 iswupper.3 iswalnum.3 iswxdigit.3
MLINKS+=isxdigit.3 ishexnumber.3
-MLINKS+=mbrune.3 mbmb.3 mbrune.3 mbrrune.3
MLINKS+=mbsrtowcs.3 mbsnrtowcs.3
-MLINKS+=rune.3 fgetrune.3 rune.3 fputrune.3 rune.3 fungetrune.3 \
- rune.3 setinvalidrune.3 rune.3 setrunelocale.3 rune.3 sgetrune.3 \
- rune.3 sputrune.3
MLINKS+=wcsrtombs.3 wcsnrtombs.3
MLINKS+=wcstod.3 wcstof.3 wcstod.3 wcstold.3
MLINKS+=wcstol.3 wcstoul.3 wcstol.3 wcstoll.3 wcstol.3 wcstoull.3 \
diff --git a/lib/libc/locale/frune.c b/lib/libc/locale/frune.c
deleted file mode 100644
index 06e585bfd3a4..000000000000
--- a/lib/libc/locale/frune.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * Copyright (c) 2003 Tim J. Robbins. All rights reserved.
- * Copyright (c) 1993
- * 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
- * are met:
- * 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
- * SUCH DAMAGE.
- */
-
-/* f*rune() are obsolete in FreeBSD 6 -- use ANSI functions instead. */
-#define OBSOLETE_IN_6
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)frune.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/param.h>
-__FBSDID("$FreeBSD$");
-
-#include <limits.h>
-#include <rune.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <wchar.h>
-
-__warn_references(fgetrune, "warning: fgetrune() is obsolete. See fgetrune(3).");
-long
-fgetrune(fp)
- FILE *fp;
-{
- wint_t ch;
-
- if ((ch = fgetwc(fp)) == WEOF)
- return (feof(fp) ? EOF : _INVALID_RUNE);
- return ((long)ch);
-}
-
-__warn_references(fungetrune, "warning: fungetrune() is obsolete. See fungetrune(3).");
-int
-fungetrune(r, fp)
- rune_t r;
- FILE* fp;
-{
-
- return (ungetwc((wint_t)r, fp) == WEOF ? EOF : 0);
-}
-
-__warn_references(fputrune, "warning: fputrune() is obsolete. See fputrune(3).");
-int
-fputrune(r, fp)
- rune_t r;
- FILE *fp;
-{
-
- return (fputwc((wchar_t)r, fp) == WEOF ? EOF : 0);
-}
diff --git a/lib/libc/locale/mblocal.h b/lib/libc/locale/mblocal.h
index 3727b72c0742..9378c0c184a5 100644
--- a/lib/libc/locale/mblocal.h
+++ b/lib/libc/locale/mblocal.h
@@ -29,8 +29,6 @@
#ifndef _MBLOCAL_H_
#define _MBLOCAL_H_
-#include <stddef.h> /* XXX for rune_t */
-
/*
* Conversion function pointers for current encoding.
*/
@@ -61,10 +59,4 @@ extern size_t __mbsnrtowcs_std(wchar_t * __restrict, const char ** __restrict,
extern size_t __wcsnrtombs_std(char * __restrict, const wchar_t ** __restrict,
size_t, size_t, mbstate_t * __restrict);
-/*
- * Rune emulation functions.
- */
-extern rune_t __emulated_sgetrune(const char *, size_t, const char **);
-extern int __emulated_sputrune(rune_t, char *, size_t, char **);
-
#endif /* _MBLOCAL_H_ */
diff --git a/lib/libc/locale/mbrune.3 b/lib/libc/locale/mbrune.3
deleted file mode 100644
index 02cab23630f6..000000000000
--- a/lib/libc/locale/mbrune.3
+++ /dev/null
@@ -1,174 +0,0 @@
-.\" Copyright (c) 1993
-.\" 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
-.\" are met:
-.\" 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
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)mbrune.3 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd August 21, 2004
-.Dt MBRUNE 3
-.Os
-.Sh NAME
-.Nm mbrune ,
-.Nm mbrrune ,
-.Nm mbmb
-.Nd multibyte rune support for C
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In rune.h
-.Ft char *
-.Fn mbrune "const char *string" "rune_t rune"
-.Ft char *
-.Fn mbrrune "const char *string" "rune_t rune"
-.Ft char *
-.Fn mbmb "const char *string" "char *pattern"
-.Sh DESCRIPTION
-.Bf Em
-The
-.Bx 4.4
-.Dq rune
-functions are obsolete and may not be supported in future releases.
-.Ef
-Applications should use the
-.Tn ISO
-C99
-.Xr wcschr 3 ,
-.Xr wcsrchr 3 ,
-and
-.Xr wcsstr 3
-functions instead.
-.Pp
-These routines provide the corresponding functionality of
-.Fn strchr ,
-.Fn strrchr
-and
-.Fn strstr
-for multibyte strings.
-.Pp
-The
-.Fn mbrune
-function locates the first occurrence of
-.Fn rune
-in the string pointed to by
-.Fa string .
-The terminating
-.Dv NUL
-character is considered part of the string.
-If
-.Fa rune
-is
-.Ql \e0 ,
-.Fn mbrune
-locates the terminating
-.Ql \e0 .
-.Pp
-The
-.Fn mbrrune
-function
-locates the last occurrence of
-.Fa rune
-in the string
-.Fa string .
-If
-.Fa rune
-is
-.Ql \e0 ,
-.Fn mbrune
-locates the terminating
-.Ql \e0 .
-.Pp
-The
-.Fn mbmb
-function locates the first occurrence of the null-terminated string
-.Fa pattern
-in the null-terminated string
-.Fa string .
-If
-.Fa pattern
-is the empty string,
-.Fn mbmb
-returns
-.Fa string ;
-if
-.Fa pattern
-occurs nowhere in
-.Fa string ,
-.Fn mbmb
-returns
-.Dv NULL ;
-otherwise
-.Fn mbmb
-returns a pointer to the first character of the first occurrence of
-.Fa pattern .
-.Sh RETURN VALUES
-The function
-.Fn mbrune
-returns a pointer to the located character, or
-.Dv NULL
-if the character does not appear in the string.
-.Pp
-The
-.Fn mbrrune
-function
-returns a pointer to the character, or
-.Dv NULL
-if the character does not appear in the string.
-.Pp
-The
-.Fn mbmb
-function
-returns a pointer to the
-.Fa pattern ,
-or
-.Dv NULL
-if the
-.Fa pattern
-does not appear in the string.
-.Sh SEE ALSO
-.Xr rune 3 ,
-.Xr setlocale 3 ,
-.Xr euc 5 ,
-.Xr utf8 5
-.Sh HISTORY
-The
-.Fn mbrune ,
-.Fn mbrrune ,
-and
-.Fn mbmb
-functions
-first appeared in Plan 9 from Bell Labs as
-.Fn utfrune ,
-.Fn utfrrune ,
-and
-.Fn utfutf .
diff --git a/lib/libc/locale/mbrune.c b/lib/libc/locale/mbrune.c
deleted file mode 100644
index 7f5c9239ca45..000000000000
--- a/lib/libc/locale/mbrune.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*-
- * Copyright (c) 1993
- * 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
- * are met:
- * 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
- * SUCH DAMAGE.
- */
-
-/* mb*rune() and mbmb() are obsolete in FreeBSD 6. */
-#define OBSOLETE_IN_6
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)mbrune.c 8.1 (Berkeley) 6/27/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/param.h>
-__FBSDID("$FreeBSD$");
-
-#include <limits.h>
-#include <rune.h>
-#include <stddef.h>
-#include <string.h>
-
-__warn_references(mbrune, "warning: mbrune() is obsolete. See mbrune(3).");
-char *
-mbrune(string, c)
- const char *string;
- rune_t c;
-{
- char const *result;
- rune_t r;
-
- while ((r = sgetrune(string, MB_LEN_MAX, &result))) {
- if (r == c)
- return ((char *)string);
- string = result == string ? string + 1 : result;
- }
-
- return (c == *string ? (char *)string : NULL);
-}
-
-__warn_references(mbrrune, "warning: mbrrune() is obsolete. See mbrrune(3).");
-char *
-mbrrune(string, c)
- const char *string;
- rune_t c;
-{
- const char *last = 0;
- char const *result;
- rune_t r;
-
- while ((r = sgetrune(string, MB_LEN_MAX, &result))) {
- if (r == c)
- last = string;
- string = result == string ? string + 1 : result;
- }
- return (c == *string ? (char *)string : (char *)last);
-}
-
-__warn_references(mbmb, "warning: mbmb() is obsolete. See mbmb(3).");
-char *
-mbmb(string, pattern)
- const char *string;
- char *pattern;
-{
- rune_t first, r;
- size_t plen, slen;
- char const *result;
-
- plen = strlen(pattern);
- slen = strlen(string);
- if (plen > slen)
- return (0);
-
- first = sgetrune(pattern, plen, &result);
- if (result == string)
- return (0);
-
- while (slen >= plen && (r = sgetrune(string, slen, &result))) {
- if (r == first) {
- if (strncmp(string, pattern, slen) == 0)
- return ((char *) string);
- }
- if (result == string) {
- --slen;
- ++string;
- } else {
- slen -= result - string;
- string = result;
- }
- }
- return (0);
-}
diff --git a/lib/libc/locale/rune.3 b/lib/libc/locale/rune.3
deleted file mode 100644
index a2f306ea9e7d..000000000000
--- a/lib/libc/locale/rune.3
+++ /dev/null
@@ -1,282 +0,0 @@
-.\" Copyright (c) 1993
-.\" 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
-.\" are met:
-.\" 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
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)rune.3 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd August 21, 2004
-.Dt RUNE 3
-.Os
-.Sh NAME
-.Nm setrunelocale ,
-.Nm setinvalidrune ,
-.Nm sgetrune ,
-.Nm sputrune ,
-.Nm fgetrune ,
-.Nm fungetrune ,
-.Nm fputrune
-.Nd rune support for C
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In rune.h
-.In errno.h
-.Ft int
-.Fn setrunelocale "char *locale"
-.Ft void
-.Fn setinvalidrune "rune_t rune"
-.Ft rune_t
-.Fn sgetrune "const char *string" "size_t n" "char const **result"
-.Ft int
-.Fn sputrune "rune_t rune" "char *string" "size_t n" "char **result"
-.Pp
-.In stdio.h
-.Ft long
-.Fn fgetrune "FILE *stream"
-.Ft int
-.Fn fungetrune "rune_t rune" "FILE *stream"
-.Ft int
-.Fn fputrune "rune_t rune" "FILE *stream"
-.Sh DESCRIPTION
-.Bf Em
-The
-.Bx 4.4
-.Dq rune
-functions are obsolete and may not be supported in future releases.
-.Ef
-Applications should use the
-.Tn ISO
-C99
-.Xr setlocale 3 ,
-.Xr mbrtowc 3 ,
-.Xr wcrtomb 3 ,
-.Xr fgetwc 3 ,
-.Xr ungetwc 3 ,
-and
-.Xr fputwc 3
-functions instead.
-.Pp
-The
-.Fn setrunelocale
-controls the type of encoding used to represent runes as multibyte strings
-as well as the properties of the runes as defined in
-.In ctype.h .
-The
-.Fa locale
-argument indicates which locale to load.
-If the locale is successfully loaded,
-.Dv 0
-is returned, otherwise an errno value is returned to indicate the
-type of error.
-.Pp
-The
-.Fn setinvalidrune
-function sets the value of the global value
-.Dv _INVALID_RUNE
-to be
-.Fa rune .
-.Pp
-The
-.Fn sgetrune
-function tries to read a single multibyte character from
-.Fa string ,
-which is at most
-.Fa n
-bytes long.
-If
-.Fn sgetrune
-is successful, the rune is returned.
-If
-.Fa result
-is not
-.Dv NULL ,
-.Fa *result
-will point to the first byte which was not converted in
-.Fa string .
-If the first
-.Fa n
-bytes of
-.Fa string
-do not describe a full multibyte character,
-.Dv _INVALID_RUNE
-is returned and
-.Fa *result
-will point to
-.Fa string .
-If there is an encoding error at the start of
-.Fa string ,
-.Dv _INVALID_RUNE
-is returned and
-.Fa *result
-will point to the second character of
-.Fa string .
-.Pp
-the
-.Fn sputrune
-function tries to encode
-.Fa rune
-as a multibyte string and store it at
-.Fa string ,
-but no more than
-.Fa n
-bytes will be stored.
-If
-.Fa result
-is not
-.Dv NULL ,
-.Fa *result
-will be set to point to the first byte in string following the new
-multibyte character.
-If
-.Fa string
-is
-.Dv NULL ,
-.Fa *result
-will point to
-.Dv "(char *)0 +"
-.Fa x ,
-where
-.Fa x
-is the number of bytes that would be needed to store the multibyte value.
-If the multibyte character would consist of more than
-.Fa n
-bytes and
-.Fa result
-is not
-.Dv NULL ,
-.Fa *result
-will be set to
-.Dv NULL .
-In all cases,
-.Fn sputrune
-will return the number of bytes which would be needed to store
-.Fa rune
-as a multibyte character.
-.Pp
-The
-.Fn fgetrune
-function operates the same as
-.Fn sgetrune
-with the exception that it attempts to read enough bytes from
-.Fa stream
-to decode a single rune.
-It returns either
-.Dv EOF
-on end of file,
-.Dv _INVALID_RUNE
-on an encoding error, or the rune decoded if all went well.
-.Pp
-The
-.Fn fungetrune
-function pushes the multibyte encoding, as provided by
-.Fn sputrune ,
-of
-.Fa rune
-onto
-.Fa stream
-such that the next
-.Fn fgetrune
-call will return
-.Fa rune .
-It returns
-.Dv EOF
-if it fails and
-.Dv 0
-on success.
-.Pp
-The
-.Fn fputrune
-function writes the multibyte encoding of
-.Fa rune ,
-as provided by
-.Fn sputrune ,
-onto
-.Fa stream .
-It returns
-.Dv EOF
-on failure and
-.Dv 0
-on success.
-.Sh RETURN VALUES
-The
-.Fn setrunelocale
-function returns one of the following values:
-.Bl -tag -width Er
-.It Er 0
-The
-.Fn setrunelocale
-function
-was successful.
-.It Bq Er EINVAL
-The
-.Fa locale
-name was incorrect.
-.It Bq Er ENOENT
-The locale could not be found.
-.It Bq Er EFTYPE
-The file found was not a valid file.
-.El
-.Pp
-The
-.Fn sgetrune
-function either returns the rune read or
-.Dv _INVALID_RUNE .
-The
-.Fn sputrune
-function returns the number of bytes needed to store
-.Fa rune
-as a multibyte string.
-.Sh FILES
-.Bl -tag -width /usr/share/locale/locale/LC_CTYPE -compact
-.It Pa $PATH_LOCALE/ Ns Em locale Ns /LC_CTYPE
-.It Pa /usr/share/locale/ Ns Em locale Ns /LC_CTYPE
-binary LC_CTYPE file for the locale
-.Em locale .
-.El
-.Sh SEE ALSO
-.Xr mbrune 3 ,
-.Xr setlocale 3 ,
-.Xr euc 5 ,
-.Xr utf8 5
-.Sh HISTORY
-These functions first appeared in
-.Bx 4.4 .
-.Pp
-The
-.Fn setrunelocale
-function and the other non-ANSI rune functions were inspired by
-.Sy "Plan 9 from Bell Labs" .
-.\"They were conceived at the San Diego 1993 Summer USENIX conference by
-.\"Paul Borman of Krystal Technologies, Keith Bostic of CSRG and Andrew Hume
-.\"of Bell Labs.
diff --git a/lib/libc/locale/setinvalidrune.c b/lib/libc/locale/setinvalidrune.c
deleted file mode 100644
index a61b01ac0b78..000000000000
--- a/lib/libc/locale/setinvalidrune.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c) 1993
- * 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
- * are met:
- * 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
- * SUCH DAMAGE.
- */
-
-/* setinvalidrune() is obsolete in FreeBSD 6 -- use WEOF instead. */
-#define OBSOLETE_IN_6
-
-#include <sys/param.h>
-__FBSDID("$FreeBSD$");
-
-#include <rune.h>
-
-__warn_references(setinvalidrune, "warning: setinvalidrune() is obsolete. See setinvalidrune(3).");
-void
-setinvalidrune(ir)
- rune_t ir;
-{
- _INVALID_RUNE = ir;
-}
diff --git a/lib/libc/locale/setlocale.3 b/lib/libc/locale/setlocale.3
index ce0c66da10dd..d8b88554321a 100644
--- a/lib/libc/locale/setlocale.3
+++ b/lib/libc/locale/setlocale.3
@@ -73,18 +73,13 @@ and
.Fn strxfrm .
.It Dv LC_CTYPE
Set a locale for the
-.Xr ctype 3 ,
-.Xr mbrune 3 ,
-.Xr multibyte 3
+.Xr ctype 3
and
-.Xr rune 3
+.Xr multibyte 3
functions.
This controls recognition of upper and lower case,
alphabetic or non-alphabetic characters,
and so on.
-The real work is done by the
-.Fn setrunelocale
-function.
.It Dv LC_MESSAGES
Set a locale for message catalogs, see
.Xr catopen 3
@@ -165,9 +160,7 @@ and the category
.Xr catopen 3 ,
.Xr ctype 3 ,
.Xr localeconv 3 ,
-.Xr mbrune 3 ,
.Xr multibyte 3 ,
-.Xr rune 3 ,
.Xr strcoll 3 ,
.Xr strxfrm 3 ,
.Xr euc 5 ,
diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c
index c2cc7f046280..5ca255c0cbaf 100644
--- a/lib/libc/locale/setrunelocale.c
+++ b/lib/libc/locale/setrunelocale.c
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <rune.h>
+#include <runetype.h>
#include <errno.h>
#include <limits.h>
#include <string.h>
@@ -159,8 +159,8 @@ __setrunelocale(const char *encoding)
__mbsnrtowcs = __mbsnrtowcs_std;
__wcrtomb = NULL;
__wcsnrtombs = __wcsnrtombs_std;
- rl->__sputrune = __emulated_sputrune;
- rl->__sgetrune = __emulated_sgetrune;
+ rl->__sputrune = NULL;
+ rl->__sgetrune = NULL;
if (strcmp(rl->__encoding, "NONE") == 0)
ret = _none_init(rl);
else if (strcmp(rl->__encoding, "UTF-8") == 0)
diff --git a/lib/libc/locale/srune.c b/lib/libc/locale/srune.c
deleted file mode 100644
index bb9326f25f11..000000000000
--- a/lib/libc/locale/srune.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*-
- * Copyright (c) 2003-2004 Tim J. Robbins
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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
- * SUCH DAMAGE.
- */
-
-/* Not required when sgetrune() and sputrune() are removed. */
-#define OBSOLETE_IN_6
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <limits.h>
-#include <rune.h>
-#include <string.h>
-#include <wchar.h>
-#include "mblocal.h"
-
-/*
- * Emulate the deprecated 4.4BSD sgetrune() function in terms of
- * the ISO C mbrtowc() function.
- */
-rune_t
-__emulated_sgetrune(const char *string, size_t n, const char **result)
-{
- static const mbstate_t initial;
- mbstate_t mbs;
- wchar_t wc;
- size_t nconv;
-
- /*
- * Pass a NULL conversion state to mbrtowc() since multibyte
- * conversion states are not supported.
- */
- mbs = initial;
- nconv = mbrtowc(&wc, string, n, &mbs);
- if (nconv == (size_t)-2) {
- if (result != NULL)
- *result = string;
- return (_INVALID_RUNE);
- }
- if (nconv == (size_t)-1) {
- if (result != NULL)
- *result = string + 1;
- return (_INVALID_RUNE);
- }
- if (nconv == 0)
- nconv = 1;
- if (result != NULL)
- *result = string + nconv;
- return ((rune_t)wc);
-}
-
-/*
- * Emulate the deprecated 4.4BSD sputrune() function in terms of
- * the ISO C wcrtomb() function.
- */
-int
-__emulated_sputrune(rune_t rune, char *string, size_t n, char **result)
-{
- static const mbstate_t initial;
- mbstate_t mbs;
- char buf[MB_LEN_MAX];
- size_t nconv;
-
- mbs = initial;
- nconv = wcrtomb(buf, (wchar_t)rune, &mbs);
- if (nconv == (size_t)-1) {
- if (result != NULL)
- *result = NULL;
- return (0);
- }
- if (string == NULL) {
- if (result != NULL)
- *result = (char *)0 + nconv;
- } else if (n >= nconv) {
- memcpy(string, buf, nconv);
- if (result != NULL)
- *result = string + nconv;
- } else {
- if (result != NULL)
- *result = NULL;
- }
- return (nconv);
-}
diff --git a/lib/libc/locale/table.c b/lib/libc/locale/table.c
index dfac185442f1..f513ceba3ce4 100644
--- a/lib/libc/locale/table.c
+++ b/lib/libc/locale/table.c
@@ -48,8 +48,8 @@ __FBSDID("$FreeBSD$");
_RuneLocale _DefaultRuneLocale = {
_RUNE_MAGIC_1,
"NONE",
- __emulated_sgetrune,
- __emulated_sputrune,
+ NULL,
+ NULL,
0xFFFD,
{ /*00*/ _CTYPE_C,