summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1995-10-23 01:34:17 +0000
committerache <ache@FreeBSD.org>1995-10-23 01:34:17 +0000
commit6ee0412bd842c62fa5a2d0cc7b5d9a09ea7305b1 (patch)
treedf3d9138c260a0dd995cf571fe1f86075fc381a2 /lib
parent7bae034de0c258030d15c9a5c797a7cbf0363b89 (diff)
downloadFreeBSD-src-6ee0412bd842c62fa5a2d0cc7b5d9a09ea7305b1.zip
FreeBSD-src-6ee0412bd842c62fa5a2d0cc7b5d9a09ea7305b1.tar.gz
Migrate from XPG4 to XPG3 (libxpg4 will be added soon)
Remove big part of my startup_setlocale hack. Add missing manpage links.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/locale/Makefile.inc8
-rw-r--r--lib/libc/locale/euc.c2
-rw-r--r--lib/libc/locale/rune.c171
-rw-r--r--lib/libc/locale/runetype.c36
-rw-r--r--lib/libc/locale/setlocale.c91
-rw-r--r--lib/libc/locale/setrunelocale.c118
-rw-r--r--lib/libc/locale/tolower.c36
-rw-r--r--lib/libc/locale/toupper.c36
-rw-r--r--lib/libc/locale/utf2.c2
9 files changed, 444 insertions, 56 deletions
diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc
index 795d1f8..b130082 100644
--- a/lib/libc/locale/Makefile.inc
+++ b/lib/libc/locale/Makefile.inc
@@ -4,8 +4,7 @@
.PATH: ${.CURDIR}/${MACHINE}/locale ${.CURDIR}/locale
SRCS+= ansi.c ctype.c euc.c frune.c isctype.c lconv.c localeconv.c \
- mbrune.c none.c rune.c common_setlocale.c \
- startup_setlocale.c read_runemagi.c setlocale.c table.c utf2.c \
+ mbrune.c none.c rune.c setlocale.c table.c utf2.c setrunelocale.c \
runetype.c tolower.c toupper.c nomacros.c collate.c
MAN3+= locale/ctype.3 locale/isalnum.3 locale/isalpha.3 locale/isascii.3 \
@@ -15,3 +14,8 @@ MAN3+= locale/ctype.3 locale/isalnum.3 locale/isalpha.3 locale/isascii.3 \
locale/rune.3 locale/setlocale.3 locale/toascii.3 locale/tolower.3 \
locale/toupper.3
MAN4+= locale/euc.4 locale/utf2.4
+MLINKS+= rune.3 setrunelocale.3 rune.3 setinvalidrune.3 rune.3 sgetrune.3 \
+ rune.3 sputrune.3 rune.3 fgetrune.3 rune.3 fungetrune.3 \
+ rune.3 fputrune.3 mbrune.3 mbrrune.3 mbrune.3 mbmb.3 \
+ multibyte.3 mblen.3 multibyte.3 mbstowcs.3 multibyte.3 mbtowc.3 \
+ multibyte.3 wcstombs.3 multibyte.3 wctomb.3 setlocale.3 localeconv.3
diff --git a/lib/libc/locale/euc.c b/lib/libc/locale/euc.c
index e58c855..bc33ff6 100644
--- a/lib/libc/locale/euc.c
+++ b/lib/libc/locale/euc.c
@@ -34,6 +34,7 @@
* SUCH DAMAGE.
*/
+#ifdef XPG4
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)euc.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
@@ -218,3 +219,4 @@ CodeSet1:
}
return (len);
}
+#endif /* XPG4 */
diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c
index 8075825..2c9c7a7 100644
--- a/lib/libc/locale/rune.c
+++ b/lib/libc/locale/rune.c
@@ -38,70 +38,143 @@
static char sccsid[] = "@(#)rune.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
#include <rune.h>
#include <stdio.h>
+#include <string.h>
#include <stdlib.h>
-#include "common_rune.h"
+#include <sys/types.h>
+#include <sys/stat.h>
-char *_PathLocale;
-
-extern int _none_init __P((_RuneLocale *));
-extern int _UTF2_init __P((_RuneLocale *));
-extern int _EUC_init __P((_RuneLocale *));
-
-int
-setrunelocale(encoding)
- char *encoding;
+void
+setinvalidrune(ir)
+ rune_t ir;
{
+ _INVALID_RUNE = ir;
+}
+
+_RuneLocale *
+_Read_RuneMagi(fp)
FILE *fp;
- char name[PATH_MAX];
+{
+ char *data;
+ void *lastp;
_RuneLocale *rl;
+ _RuneEntry *rr;
+ struct stat sb;
+ int x;
- if (!encoding)
- return(EFAULT);
+ if (fstat(fileno(fp), &sb) < 0)
+ return(0);
- /*
- * The "C" and "POSIX" locale are always here.
- */
- if (!strcmp(encoding, "C") || !strcmp(encoding, "POSIX")) {
- _CurrentRuneLocale = &_DefaultRuneLocale;
+ if (sb.st_size < sizeof(_RuneLocale))
+ return(0);
+
+ if ((data = malloc(sb.st_size)) == NULL)
+ return(0);
+
+ rewind(fp); /* Someone might have read the magic number once already */
+
+ if (fread(data, sb.st_size, 1, fp) != 1) {
+ free(data);
return(0);
}
- if (!PathLocale && !(PathLocale = getenv("PATH_LOCALE")))
- PathLocale = _PATH_LOCALE;
+ rl = (_RuneLocale *)data;
+ lastp = data + sb.st_size;
- (void) strcpy(name, PathLocale);
- (void) strcat(name, "/");
- (void) strcat(name, encoding);
- (void) strcat(name, "/LC_CTYPE");
+ rl->variable = rl + 1;
- if ((fp = fopen(name, "r")) == NULL)
- return(ENOENT);
+ if (memcmp(rl->magic, _RUNE_MAGIC_1, sizeof(rl->magic))) {
+ free(data);
+ return(0);
+ }
+
+ rl->invalid_rune = ntohl(rl->invalid_rune);
+ rl->variable_len = ntohl(rl->variable_len);
+ rl->runetype_ext.nranges = ntohl(rl->runetype_ext.nranges);
+ rl->maplower_ext.nranges = ntohl(rl->maplower_ext.nranges);
+ rl->mapupper_ext.nranges = ntohl(rl->mapupper_ext.nranges);
- if ((rl = _Read_RuneMagi(fp)) == 0) {
- fclose(fp);
- return(EFTYPE);
+ for (x = 0; x < _CACHED_RUNES; ++x) {
+ rl->runetype[x] = ntohl(rl->runetype[x]);
+ rl->maplower[x] = ntohl(rl->maplower[x]);
+ rl->mapupper[x] = ntohl(rl->mapupper[x]);
}
- fclose(fp);
-
- if (!rl->encoding[0] || !strcmp(rl->encoding, "UTF2")) {
- return(_UTF2_init(rl));
- } else if (!strcmp(rl->encoding, "NONE")) {
- return(_none_init(rl));
- } else if (!strcmp(rl->encoding, "EUC")) {
- return(_EUC_init(rl));
- } else
- return(EINVAL);
-}
-void
-setinvalidrune(ir)
- rune_t ir;
-{
- _INVALID_RUNE = ir;
-}
+ rl->runetype_ext.ranges = (_RuneEntry *)rl->variable;
+ rl->variable = rl->runetype_ext.ranges + rl->runetype_ext.nranges;
+ if (rl->variable > lastp) {
+ free(data);
+ return(0);
+ }
+
+ rl->maplower_ext.ranges = (_RuneEntry *)rl->variable;
+ rl->variable = rl->maplower_ext.ranges + rl->maplower_ext.nranges;
+ if (rl->variable > lastp) {
+ free(data);
+ return(0);
+ }
+
+ rl->mapupper_ext.ranges = (_RuneEntry *)rl->variable;
+ rl->variable = rl->mapupper_ext.ranges + rl->mapupper_ext.nranges;
+ if (rl->variable > lastp) {
+ free(data);
+ return(0);
+ }
+
+ for (x = 0; x < rl->runetype_ext.nranges; ++x) {
+ rr = rl->runetype_ext.ranges;
+
+ rr[x].min = ntohl(rr[x].min);
+ rr[x].max = ntohl(rr[x].max);
+ if ((rr[x].map = ntohl(rr[x].map)) == 0) {
+ int len = rr[x].max - rr[x].min + 1;
+ rr[x].types = rl->variable;
+ rl->variable = rr[x].types + len;
+ if (rl->variable > lastp) {
+ free(data);
+ return(0);
+ }
+ while (len-- > 0)
+ rr[x].types[len] = ntohl(rr[x].types[len]);
+ } else
+ rr[x].types = 0;
+ }
+
+ for (x = 0; x < rl->maplower_ext.nranges; ++x) {
+ rr = rl->maplower_ext.ranges;
+
+ rr[x].min = ntohl(rr[x].min);
+ rr[x].max = ntohl(rr[x].max);
+ rr[x].map = ntohl(rr[x].map);
+ }
+
+ for (x = 0; x < rl->mapupper_ext.nranges; ++x) {
+ rr = rl->mapupper_ext.ranges;
+ rr[x].min = ntohl(rr[x].min);
+ rr[x].max = ntohl(rr[x].max);
+ rr[x].map = ntohl(rr[x].map);
+ }
+ if (((char *)rl->variable) + rl->variable_len > (char *)lastp) {
+ free(data);
+ return(0);
+ }
+
+ /*
+ * Go out and zero pointers that should be zero.
+ */
+ if (!rl->variable_len)
+ rl->variable = 0;
+
+ if (!rl->runetype_ext.nranges)
+ rl->runetype_ext.ranges = 0;
+
+ if (!rl->maplower_ext.nranges)
+ rl->maplower_ext.ranges = 0;
+
+ if (!rl->mapupper_ext.nranges)
+ rl->mapupper_ext.ranges = 0;
+
+ return(rl);
+}
diff --git a/lib/libc/locale/runetype.c b/lib/libc/locale/runetype.c
index b2c0e39..6dd7ea8 100644
--- a/lib/libc/locale/runetype.c
+++ b/lib/libc/locale/runetype.c
@@ -1,3 +1,39 @@
+/*-
+ * 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.
+ */
+
#include <stdio.h>
#include <rune.h>
diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c
index c2efd5b..cb5da65 100644
--- a/lib/libc/locale/setlocale.c
+++ b/lib/libc/locale/setlocale.c
@@ -43,13 +43,49 @@ static char sccsid[] = "@(#)setlocale.c 8.1 (Berkeley) 7/4/93";
#include <rune.h>
#include <stdlib.h>
#include <string.h>
-#include "common_setlocale.h"
-#include "common_rune.h"
+#include "collate.h"
+/*
+ * Category names for getenv()
+ */
+static char *categories[_LC_LAST] = {
+ "LC_ALL",
+ "LC_COLLATE",
+ "LC_CTYPE",
+ "LC_MONETARY",
+ "LC_NUMERIC",
+ "LC_TIME",
+};
+
+/*
+ * Current locales for each category
+ */
+static char current_categories[_LC_LAST][32] = {
+ "C",
+ "C",
+ "C",
+ "C",
+ "C",
+ "C",
+};
+
+/*
+ * The locales we are going to try and load
+ */
+static char new_categories[_LC_LAST][32];
+
+static char current_locale_string[_LC_LAST * 33];
char *_PathLocale;
+static char *currentlocale __P((void));
static char *loadlocale __P((int));
+extern int __time_load_locale __P((const char *)); /* strftime.c */
+
+#ifdef XPG4
+extern int _xpg4_setrunelocale __P((char *));
+#endif
+
char *
setlocale(category, locale)
int category;
@@ -58,8 +94,8 @@ setlocale(category, locale)
int found, i, len;
char *env, *r;
- if (!PathLocale && !(PathLocale = getenv("PATH_LOCALE")))
- PathLocale = _PATH_LOCALE;
+ if (!_PathLocale && !(_PathLocale = getenv("PATH_LOCALE")))
+ _PathLocale = _PATH_LOCALE;
if (category < 0 || category >= _LC_LAST)
return (NULL);
@@ -139,6 +175,47 @@ setlocale(category, locale)
return (NULL);
}
+#ifndef XPG4
+/* To be compatible with old binaries */
+void
+_startup_setlocale(category, locale)
+ int category;
+ const char *locale;
+{
+ (void) setlocale(category, locale);
+}
+#endif
+
+static char *
+currentlocale()
+{
+ int i, len;
+
+ (void)strcpy(current_locale_string, current_categories[1]);
+
+ for (i = 2; i < _LC_LAST; ++i)
+ if (strcmp(current_categories[1], current_categories[i])) {
+ len = strlen(current_categories[1]) + 1 +
+ strlen(current_categories[2]) + 1 +
+ strlen(current_categories[3]) + 1 +
+ strlen(current_categories[4]) + 1 +
+ strlen(current_categories[5]) + 1;
+ if (len > sizeof(current_locale_string))
+ return NULL;
+ (void) strcpy(current_locale_string, current_categories[1]);
+ (void) strcat(current_locale_string, "/");
+ (void) strcat(current_locale_string, current_categories[2]);
+ (void) strcat(current_locale_string, "/");
+ (void) strcat(current_locale_string, current_categories[3]);
+ (void) strcat(current_locale_string, "/");
+ (void) strcat(current_locale_string, current_categories[4]);
+ (void) strcat(current_locale_string, "/");
+ (void) strcat(current_locale_string, current_categories[5]);
+ break;
+ }
+ return (current_locale_string);
+}
+
static char *
loadlocale(category)
int category;
@@ -151,7 +228,11 @@ loadlocale(category)
return (current_categories[category]);
if (category == LC_CTYPE) {
+#ifdef XPG4
+ if (_xpg4_setrunelocale(new_categories[LC_CTYPE]))
+#else
if (setrunelocale(new_categories[LC_CTYPE]))
+#endif
return (NULL);
(void)strcpy(current_categories[LC_CTYPE],
new_categories[LC_CTYPE]);
@@ -191,7 +272,7 @@ loadlocale(category)
* Some day we will actually look at this file.
*/
(void)snprintf(name, sizeof(name), "%s/%s/%s",
- PathLocale, new_categories[category], categories[category]);
+ _PathLocale, new_categories[category], categories[category]);
#endif
switch (category) {
case LC_MONETARY:
diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c
new file mode 100644
index 0000000..f2af359
--- /dev/null
+++ b/lib/libc/locale/setrunelocale.c
@@ -0,0 +1,118 @@
+/*-
+ * 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.
+ */
+
+#include <rune.h>
+#include <errno.h>
+#include <limits.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+char *_PathLocale;
+
+extern int _none_init __P((_RuneLocale *));
+#ifdef XPG4
+extern int _UTF2_init __P((_RuneLocale *));
+extern int _EUC_init __P((_RuneLocale *));
+#endif
+extern _RuneLocale *_Read_RuneMagi __P((FILE *));
+
+#ifdef XPG4
+int
+setrunelocale(encoding)
+ char *encoding;
+{
+ return _xpg4_setrunelocale(encoding);
+}
+#endif
+
+int
+#ifndef XPG4
+setrunelocale(encoding)
+#else
+_xpg4_setrunelocale(encoding)
+#endif
+ char *encoding;
+{
+ FILE *fp;
+ char name[PATH_MAX];
+ _RuneLocale *rl;
+
+ if (!encoding)
+ return(EFAULT);
+
+ /*
+ * The "C" and "POSIX" locale are always here.
+ */
+ if (!strcmp(encoding, "C") || !strcmp(encoding, "POSIX")) {
+ _CurrentRuneLocale = &_DefaultRuneLocale;
+ return(0);
+ }
+
+ if (!_PathLocale && !(_PathLocale = getenv("PATH_LOCALE")))
+ _PathLocale = _PATH_LOCALE;
+
+ (void) strcpy(name, _PathLocale);
+ (void) strcat(name, "/");
+ (void) strcat(name, encoding);
+ (void) strcat(name, "/LC_CTYPE");
+
+ if ((fp = fopen(name, "r")) == NULL)
+ return(ENOENT);
+
+ if ((rl = _Read_RuneMagi(fp)) == 0) {
+ fclose(fp);
+ return(EFTYPE);
+ }
+ fclose(fp);
+
+#ifdef XPG4
+ if (!rl->encoding[0] || !strcmp(rl->encoding, "UTF2")) {
+ return(_UTF2_init(rl));
+#else
+ if (!rl->encoding[0]) {
+ return(EINVAL);
+#endif
+ } else if (!strcmp(rl->encoding, "NONE")) {
+ return(_none_init(rl));
+#ifdef XPG4
+ } else if (!strcmp(rl->encoding, "EUC")) {
+ return(_EUC_init(rl));
+#endif
+ } else
+ return(EINVAL);
+}
+
diff --git a/lib/libc/locale/tolower.c b/lib/libc/locale/tolower.c
index 995cdce..f1d6fe0 100644
--- a/lib/libc/locale/tolower.c
+++ b/lib/libc/locale/tolower.c
@@ -1,3 +1,39 @@
+/*-
+ * 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.
+ */
+
#include <stdio.h>
#include <rune.h>
diff --git a/lib/libc/locale/toupper.c b/lib/libc/locale/toupper.c
index 1f6c722..1e5aa40 100644
--- a/lib/libc/locale/toupper.c
+++ b/lib/libc/locale/toupper.c
@@ -1,3 +1,39 @@
+/*-
+ * 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.
+ */
+
#include <stdio.h>
#include <rune.h>
diff --git a/lib/libc/locale/utf2.c b/lib/libc/locale/utf2.c
index 846fad9..c46dd93 100644
--- a/lib/libc/locale/utf2.c
+++ b/lib/libc/locale/utf2.c
@@ -34,6 +34,7 @@
* SUCH DAMAGE.
*/
+#ifdef XPG4
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)utf2.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
@@ -146,3 +147,4 @@ _UTF2_sputrune(c, string, n, result)
return (1);
}
}
+#endif /* XPG4 */
OpenPOWER on IntegriCloud