cope with runeglue.c failure better
This commit is contained in:
parent
85339e75d6
commit
ce0a5e58ed
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rune_local.h,v 1.1 2000/12/21 11:29:47 itojun Exp $ */
|
||||
/* $NetBSD: rune_local.h,v 1.2 2000/12/22 22:51:22 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Citrus Project,
|
||||
@ -37,7 +37,7 @@ extern _RuneLocale *_findrunelocale __P((char *));
|
||||
extern int _newrunelocale __P((char *));
|
||||
|
||||
/* runeglue.c */
|
||||
extern int __runetable_to_netbsd_ctype __P((void));
|
||||
extern int __runetable_to_netbsd_ctype __P((const char *));
|
||||
|
||||
/* multibyte.c */
|
||||
int _mbsinit_rl __P((const mbstate_t *, _RuneLocale *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: runeglue.c,v 1.2 2000/12/21 11:29:47 itojun Exp $ */
|
||||
/* $NetBSD: runeglue.c,v 1.3 2000/12/22 22:51:22 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@ -35,7 +35,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: runeglue.c,v 1.2 2000/12/21 11:29:47 itojun Exp $");
|
||||
__RCSID("$NetBSD: runeglue.c,v 1.3 2000/12/22 22:51:22 itojun Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define _CTYPE_PRIVATE
|
||||
@ -55,7 +55,8 @@ __RCSID("$NetBSD: runeglue.c,v 1.2 2000/12/21 11:29:47 itojun Exp $");
|
||||
#endif
|
||||
|
||||
int
|
||||
__runetable_to_netbsd_ctype()
|
||||
__runetable_to_netbsd_ctype(locale)
|
||||
const char *locale;
|
||||
{
|
||||
int i;
|
||||
unsigned char *new_ctype;
|
||||
@ -78,6 +79,9 @@ __runetable_to_netbsd_ctype()
|
||||
_tolower_tab_ = _C_tolower_;
|
||||
}
|
||||
|
||||
if (!strcmp(locale, "C") || !strcmp(locale, "POSIX"))
|
||||
return 0;
|
||||
|
||||
new_ctype = malloc(sizeof(*new_ctype) * (1 + _CTYPE_NUM_CHARS));
|
||||
if (!new_ctype)
|
||||
return -1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setlocale.c,v 1.28 2000/12/22 22:28:09 itojun Exp $ */
|
||||
/* $NetBSD: setlocale.c,v 1.29 2000/12/22 22:51:22 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)setlocale.c 8.1 (Berkeley) 7/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: setlocale.c,v 1.28 2000/12/22 22:28:09 itojun Exp $");
|
||||
__RCSID("$NetBSD: setlocale.c,v 1.29 2000/12/22 22:51:22 itojun Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@ -255,22 +255,8 @@ loadlocale(category)
|
||||
|
||||
switch (category) {
|
||||
case LC_CTYPE:
|
||||
if (_ctype_ != _C_ctype_) {
|
||||
/* LINTED const castaway */
|
||||
free((void *)_ctype_);
|
||||
_ctype_ = _C_ctype_;
|
||||
}
|
||||
if (_toupper_tab_ != _C_toupper_) {
|
||||
/* LINTED const castaway */
|
||||
free((void *)_toupper_tab_);
|
||||
_toupper_tab_ = _C_toupper_;
|
||||
}
|
||||
if (_tolower_tab_ != _C_tolower_) {
|
||||
/* LINTED const castaway */
|
||||
free((void *)_tolower_tab_);
|
||||
_tolower_tab_ = _C_tolower_;
|
||||
}
|
||||
(void)_xpg4_setrunelocale("C");
|
||||
(void)__runetable_to_netbsd_ctype("C");
|
||||
}
|
||||
|
||||
(void)strlcpy(current_categories[category],
|
||||
@ -287,17 +273,20 @@ loadlocale(category)
|
||||
|
||||
switch (category) {
|
||||
case LC_CTYPE:
|
||||
if (!_xpg4_setrunelocale(new_categories[category]) &&
|
||||
!__runetable_to_netbsd_ctype()) {
|
||||
(void)strlcpy(current_categories[category],
|
||||
new_categories[category],
|
||||
sizeof(current_categories[category]));
|
||||
return current_categories[category];
|
||||
} else {
|
||||
__setlocale(LC_CTYPE, "C");
|
||||
if (!_xpg4_setrunelocale(new_categories[category]))
|
||||
return NULL;
|
||||
if (!__runetable_to_netbsd_ctype(new_categories[category])) {
|
||||
/* very unfortunate, but need to go to "C" locale */
|
||||
(void)_xpg4_setrunelocale("C");
|
||||
(void)__runetable_to_netbsd_ctype("C");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
(void)strlcpy(current_categories[category],
|
||||
new_categories[category],
|
||||
sizeof(current_categories[category]));
|
||||
return current_categories[category];
|
||||
|
||||
case LC_COLLATE:
|
||||
case LC_MESSAGES:
|
||||
case LC_MONETARY:
|
||||
|
Loading…
Reference in New Issue
Block a user