From 50dddc0919baff9cbacfd717c0dedf5b21688989 Mon Sep 17 00:00:00 2001 From: ache Date: Sat, 3 Jun 2000 12:24:08 +0000 Subject: Megre XPG4 code into libc --- lib/libc/locale/big5.c | 4 ++-- lib/libc/locale/euc.c | 4 ++-- lib/libc/locale/mskanji.c | 4 ++-- lib/libc/locale/runetype.c | 5 +++-- lib/libc/locale/setlocale.c | 16 ++-------------- lib/libc/locale/setrunelocale.c | 27 ++++----------------------- lib/libc/locale/table.c | 2 +- lib/libc/locale/tolower.c | 5 +++-- lib/libc/locale/toupper.c | 5 +++-- lib/libc/locale/utf2.c | 4 ++-- 10 files changed, 24 insertions(+), 52 deletions(-) diff --git a/lib/libc/locale/big5.c b/lib/libc/locale/big5.c index 9294f0c..b8628dd 100644 --- a/lib/libc/locale/big5.c +++ b/lib/libc/locale/big5.c @@ -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 */ diff --git a/lib/libc/locale/euc.c b/lib/libc/locale/euc.c index ea5cdb4..3c81012 100644 --- a/lib/libc/locale/euc.c +++ b/lib/libc/locale/euc.c @@ -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 @@ CodeSet1: } return (len); } -#endif /* XPG4 */ diff --git a/lib/libc/locale/mskanji.c b/lib/libc/locale/mskanji.c index bce27fe..6c3199e 100644 --- a/lib/libc/locale/mskanji.c +++ b/lib/libc/locale/mskanji.c @@ -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 */ diff --git a/lib/libc/locale/runetype.c b/lib/libc/locale/runetype.c index 282f806..dde54a4 100644 --- a/lib/libc/locale/runetype.c +++ b/lib/libc/locale/runetype.c @@ -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 @@ -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); } diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c index 179be54..f5f5fae 100644 --- a/lib/libc/locale/setlocale.c +++ b/lib/libc/locale/setlocale.c @@ -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); } diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c index 8cfddab..55d6ba9 100644 --- a/lib/libc/locale/setrunelocale.c +++ b/lib/libc/locale/setrunelocale.c @@ -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 @@ -44,30 +46,14 @@ #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; @@ -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); } diff --git a/lib/libc/locale/table.c b/lib/libc/locale/table.c index 2fe979c..1c81e80 100644 --- a/lib/libc/locale/table.c +++ b/lib/libc/locale/table.c @@ -49,7 +49,7 @@ extern int _none_init __P((char *, char **)); _RuneLocale _DefaultRuneLocale = { _RUNE_MAGIC_1, - "none", + "NONE", _none_sgetrune, _none_sputrune, 0xFFFD, diff --git a/lib/libc/locale/tolower.c b/lib/libc/locale/tolower.c index 65d5175..d9cbd6f 100644 --- a/lib/libc/locale/tolower.c +++ b/lib/libc/locale/tolower.c @@ -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 @@ -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); } diff --git a/lib/libc/locale/toupper.c b/lib/libc/locale/toupper.c index d2e4480..d01104b0 100644 --- a/lib/libc/locale/toupper.c +++ b/lib/libc/locale/toupper.c @@ -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 @@ -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); } diff --git a/lib/libc/locale/utf2.c b/lib/libc/locale/utf2.c index 52b4cad..81a9412 100644 --- a/lib/libc/locale/utf2.c +++ b/lib/libc/locale/utf2.c @@ -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 */ -- cgit v1.1