2005-11-29 06:11:58 +03:00
|
|
|
/* $NetBSD: nl_langinfo.c,v 1.11 2005/11/29 03:11:59 christos Exp $ */
|
1997-04-29 20:40:13 +04:00
|
|
|
|
1994-06-21 08:14:00 +04:00
|
|
|
/*
|
2003-07-26 23:24:24 +04:00
|
|
|
* Written by J.T. Conklin <jtc@NetBSD.org>.
|
1995-04-29 03:19:22 +04:00
|
|
|
* Public domain.
|
1994-06-21 08:14:00 +04:00
|
|
|
*/
|
|
|
|
|
1997-07-13 23:54:55 +04:00
|
|
|
#include <sys/cdefs.h>
|
1994-06-21 08:14:00 +04:00
|
|
|
#if defined(LIBC_SCCS) && !defined(lint)
|
2005-11-29 06:11:58 +03:00
|
|
|
__RCSID("$NetBSD: nl_langinfo.c,v 1.11 2005/11/29 03:11:59 christos Exp $");
|
1994-06-21 08:14:00 +04:00
|
|
|
#endif /* LIBC_SCCS and not lint */
|
|
|
|
|
1994-09-29 07:57:04 +03:00
|
|
|
#include <sys/localedef.h>
|
1994-06-21 08:14:00 +04:00
|
|
|
#include <locale.h>
|
|
|
|
#include <nl_types.h>
|
|
|
|
#include <langinfo.h>
|
2001-03-26 23:55:42 +04:00
|
|
|
#include "rune.h"
|
|
|
|
#include "runetype.h"
|
1994-06-21 08:14:00 +04:00
|
|
|
|
|
|
|
char *
|
|
|
|
nl_langinfo(item)
|
|
|
|
nl_item item;
|
|
|
|
{
|
|
|
|
const char *s;
|
|
|
|
|
|
|
|
switch (item) {
|
|
|
|
case D_T_FMT:
|
1994-09-29 07:57:04 +03:00
|
|
|
s = _CurrentTimeLocale->d_t_fmt;
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case D_FMT:
|
1994-09-29 07:57:04 +03:00
|
|
|
s = _CurrentTimeLocale->d_fmt;
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case T_FMT:
|
1994-09-29 07:57:04 +03:00
|
|
|
s = _CurrentTimeLocale->t_fmt;
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case T_FMT_AMPM:
|
1994-09-29 07:57:04 +03:00
|
|
|
s = _CurrentTimeLocale->t_fmt_ampm;
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case AM_STR:
|
|
|
|
case PM_STR:
|
1998-11-13 18:46:52 +03:00
|
|
|
s = _CurrentTimeLocale->am_pm[(size_t)(item - AM_STR)];
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case DAY_1:
|
|
|
|
case DAY_2:
|
|
|
|
case DAY_3:
|
|
|
|
case DAY_4:
|
|
|
|
case DAY_5:
|
|
|
|
case DAY_6:
|
|
|
|
case DAY_7:
|
1998-11-13 18:46:52 +03:00
|
|
|
s = _CurrentTimeLocale->day[(size_t)(item - DAY_1)];
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case ABDAY_1:
|
|
|
|
case ABDAY_2:
|
|
|
|
case ABDAY_3:
|
|
|
|
case ABDAY_4:
|
|
|
|
case ABDAY_5:
|
|
|
|
case ABDAY_6:
|
|
|
|
case ABDAY_7:
|
1998-11-13 18:46:52 +03:00
|
|
|
s = _CurrentTimeLocale->abday[(size_t)(item - ABDAY_1)];
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case MON_1:
|
|
|
|
case MON_2:
|
|
|
|
case MON_3:
|
|
|
|
case MON_4:
|
|
|
|
case MON_5:
|
|
|
|
case MON_6:
|
|
|
|
case MON_7:
|
|
|
|
case MON_8:
|
|
|
|
case MON_9:
|
|
|
|
case MON_10:
|
|
|
|
case MON_11:
|
|
|
|
case MON_12:
|
1998-11-13 18:46:52 +03:00
|
|
|
s = _CurrentTimeLocale->mon[(size_t)(item - MON_1)];
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case ABMON_1:
|
|
|
|
case ABMON_2:
|
|
|
|
case ABMON_3:
|
|
|
|
case ABMON_4:
|
|
|
|
case ABMON_5:
|
|
|
|
case ABMON_6:
|
|
|
|
case ABMON_7:
|
|
|
|
case ABMON_8:
|
|
|
|
case ABMON_9:
|
|
|
|
case ABMON_10:
|
|
|
|
case ABMON_11:
|
|
|
|
case ABMON_12:
|
1998-11-13 18:46:52 +03:00
|
|
|
s = _CurrentTimeLocale->abmon[(size_t)(item - ABMON_1)];
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case RADIXCHAR:
|
1994-09-29 07:57:04 +03:00
|
|
|
s = _CurrentNumericLocale->decimal_point;
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case THOUSEP:
|
1994-09-29 07:57:04 +03:00
|
|
|
s = _CurrentNumericLocale->thousands_sep;
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
1994-09-29 07:57:04 +03:00
|
|
|
case YESSTR:
|
|
|
|
s = _CurrentMessagesLocale->yesstr;
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
1994-09-29 07:57:04 +03:00
|
|
|
case YESEXPR:
|
|
|
|
s = _CurrentMessagesLocale->yesexpr;
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
1994-09-29 07:57:04 +03:00
|
|
|
case NOSTR:
|
|
|
|
s = _CurrentMessagesLocale->nostr;
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
1994-09-29 07:57:04 +03:00
|
|
|
case NOEXPR:
|
|
|
|
s = _CurrentMessagesLocale->noexpr;
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
case CRNCYSTR: /* XXX */
|
1994-09-29 07:57:04 +03:00
|
|
|
s = "";
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
2001-03-26 23:55:42 +04:00
|
|
|
case CODESET:
|
2004-07-22 00:27:46 +04:00
|
|
|
#ifdef WITH_RUNE
|
refine i18n stuffs.
- add libc/citrus directory.
this directory contains the common stuffs not only for locale
but also other facilities relating to i18n (e.g. iconv).
- To keep the binary compatibility for the ctype modules easily,
the interface between libc and the modules is simplified.
- For the future integrated extension, module pool is renamed
from "/usr/lib/runemodule" to "/usr/lib/i18n".
In the future, this directory will contain the modules for "iconv",
"collation", etc.
- some cosmetic changes.
- Bug fix for runetype.h; __attribute__((__packed__)) is placed at
the wrong position and it is invalid unintentionally.
But, the all members of the structures seem well-aligned. Thus,
this bug causes no problem, hopefully.
HEADS UP:
- /usr/lib/rumemodule is obsoleted. If you use the multibyte locales,
you need to install /usr/lib/i18n/* from sys/lib/i18n_module .
- The binary compatibility of /usr/share/locale/*/LC_CTYPE is probably kept.
Perhaps, the bug fix about __packed__ mentioned above breaks the
compatibility... Be careful especially on 64bit platforms.
2002-03-18 01:14:05 +03:00
|
|
|
s = _CurrentRuneLocale->rl_codeset;
|
2004-07-22 00:27:46 +04:00
|
|
|
#else
|
|
|
|
s = NULL;
|
|
|
|
#endif
|
2001-03-26 23:55:42 +04:00
|
|
|
if (!s)
|
|
|
|
s = "";
|
|
|
|
break;
|
1994-06-21 08:14:00 +04:00
|
|
|
default:
|
1994-09-29 07:57:04 +03:00
|
|
|
s = "";
|
1994-06-21 08:14:00 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1998-11-13 18:46:52 +03:00
|
|
|
/* The return value should be really const, but the interface says OW */
|
2005-11-29 06:11:58 +03:00
|
|
|
return __UNCONST(s);
|
1994-06-21 08:14:00 +04:00
|
|
|
}
|