Megre XPG4 code into libc

This commit is contained in:
ache 2000-06-03 12:24:08 +00:00
parent 81a380b9f4
commit 751bfd4596
10 changed files with 24 additions and 52 deletions

View File

@ -32,9 +32,10 @@
* 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.
*
* $FreeBSD$
*/
#ifdef XPG4
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)big5.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
@ -117,4 +118,3 @@ _BIG5_sputrune(c, string, n, result)
return (0);
}
#endif /* XPG4 */

View File

@ -32,9 +32,10 @@
* 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.
*
* $FreeBSD$
*/
#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 */
@ -220,4 +221,3 @@ _EUC_sputrune(c, string, n, result)
}
return (len);
}
#endif /* XPG4 */

View File

@ -29,9 +29,10 @@
* 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.
*
* $FreeBSD$
*/
#ifdef XPG4
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)mskanji.c 1.0 (Phase One) 5/5/95";
#endif /* LIBC_SCCS and not lint */
@ -104,4 +105,3 @@ _MSKanji_sputrune(c, string, n, result)
}
return len;
}
#endif /* XPG4 */

View File

@ -32,6 +32,8 @@
* 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.
*
* $FreeBSD$
*/
#include <stdio.h>
@ -41,7 +43,6 @@ unsigned long
___runetype(c)
_BSD_CT_RUNE_T_ c;
{
#ifdef XPG4
int x;
_RuneRange *rr = &_CurrentRuneLocale->runetype_ext;
_RuneEntry *re = rr->ranges;
@ -59,6 +60,6 @@ ___runetype(c)
return(re->map);
}
}
#endif
return(0L);
}

View File

@ -96,10 +96,6 @@ static int stub_load_locale __P((const char *));
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;
@ -243,18 +239,10 @@ loadlocale(category)
return (old);
if (category == LC_CTYPE) {
#ifdef XPG4
ret = _xpg4_setrunelocale(new) ? NULL : new;
#else
ret = setrunelocale(new) ? NULL : new;
#endif
if (!ret) {
#ifdef XPG4
(void)_xpg4_setrunelocale(old);
#else
if (!ret)
(void)setrunelocale(old);
#endif
} else
else
(void)strcpy(old, new);
return (ret);
}

View File

@ -32,6 +32,8 @@
* 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.
*
* $FreeBSD$
*/
#include <rune.h>
@ -44,31 +46,15 @@
#include "setlocale.h"
extern int _none_init __P((_RuneLocale *));
#ifdef XPG4
extern int _UTF2_init __P((_RuneLocale *));
extern int _EUC_init __P((_RuneLocale *));
extern int _BIG5_init __P((_RuneLocale *));
extern int _MSKanji_init __P((_RuneLocale *));
extern int _xpg4_setrunelocale __P((char *));
#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];
@ -117,23 +103,18 @@ _xpg4_setrunelocale(encoding)
}
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, "UTF2"))
return(_UTF2_init(rl));
else if (!strcmp(rl->encoding, "EUC"))
return(_EUC_init(rl));
else if (!strcmp(rl->encoding, "BIG5"))
return(_BIG5_init(rl));
else if (!strcmp(rl->encoding, "MSKanji"))
return(_MSKanji_init(rl));
#endif
else
return(EINVAL);
}

View File

@ -49,7 +49,7 @@ extern int _none_init __P((char *, char **));
_RuneLocale _DefaultRuneLocale = {
_RUNE_MAGIC_1,
"none",
"NONE",
_none_sgetrune,
_none_sputrune,
0xFFFD,

View File

@ -32,6 +32,8 @@
* 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.
*
* $FreeBSD$
*/
#include <stdio.h>
@ -41,7 +43,6 @@ _BSD_CT_RUNE_T_
___tolower(c)
_BSD_CT_RUNE_T_ c;
{
#ifdef XPG4
int x;
_RuneRange *rr = &_CurrentRuneLocale->maplower_ext;
_RuneEntry *re = rr->ranges;
@ -55,6 +56,6 @@ ___tolower(c)
if (c <= re->max)
return(re->map + c - re->min);
}
#endif
return(c);
}

View File

@ -32,6 +32,8 @@
* 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.
*
* $FreeBSD$
*/
#include <stdio.h>
@ -41,7 +43,6 @@ _BSD_CT_RUNE_T_
___toupper(c)
_BSD_CT_RUNE_T_ c;
{
#ifdef XPG4
int x;
_RuneRange *rr = &_CurrentRuneLocale->mapupper_ext;
_RuneEntry *re = rr->ranges;
@ -55,6 +56,6 @@ ___toupper(c)
if (c <= re->max)
return(re->map + c - re->min);
}
#endif
return(c);
}

View File

@ -32,9 +32,10 @@
* 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.
*
* $FreeBSD$
*/
#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 */
@ -147,4 +148,3 @@ _UTF2_sputrune(c, string, n, result)
return (1);
}
}
#endif /* XPG4 */