1 /* $NetBSD: nl_langinfo.c,v 1.11 2005/11/29 03:11:59 christos Exp $ */ 2 3 /* 4 * Written by J.T. Conklin <jtc (at) NetBSD.org>. 5 * Public domain. 6 */ 7 #include <LibConfig.h> 8 #include <sys/EfiCdefs.h> 9 #if defined(LIBC_SCCS) && !defined(lint) 10 __RCSID("$NetBSD: nl_langinfo.c,v 1.11 2005/11/29 03:11:59 christos Exp $"); 11 #endif /* LIBC_SCCS and not lint */ 12 13 #include <sys/localedef.h> 14 #include <locale.h> 15 #include <nl_types.h> 16 #include <langinfo.h> 17 #include "rune.h" 18 #include "runetype.h" 19 20 char * 21 nl_langinfo(nl_item item) 22 { 23 const char *s; 24 25 switch (item) { 26 case D_T_FMT: 27 s = _CurrentTimeLocale->d_t_fmt; 28 break; 29 case D_FMT: 30 s = _CurrentTimeLocale->d_fmt; 31 break; 32 case T_FMT: 33 s = _CurrentTimeLocale->t_fmt; 34 break; 35 case T_FMT_AMPM: 36 s = _CurrentTimeLocale->t_fmt_ampm; 37 break; 38 case AM_STR: 39 case PM_STR: 40 s = _CurrentTimeLocale->am_pm[(size_t)(item - AM_STR)]; 41 break; 42 case DAY_1: 43 case DAY_2: 44 case DAY_3: 45 case DAY_4: 46 case DAY_5: 47 case DAY_6: 48 case DAY_7: 49 s = _CurrentTimeLocale->day[(size_t)(item - DAY_1)]; 50 break; 51 case ABDAY_1: 52 case ABDAY_2: 53 case ABDAY_3: 54 case ABDAY_4: 55 case ABDAY_5: 56 case ABDAY_6: 57 case ABDAY_7: 58 s = _CurrentTimeLocale->abday[(size_t)(item - ABDAY_1)]; 59 break; 60 case MON_1: 61 case MON_2: 62 case MON_3: 63 case MON_4: 64 case MON_5: 65 case MON_6: 66 case MON_7: 67 case MON_8: 68 case MON_9: 69 case MON_10: 70 case MON_11: 71 case MON_12: 72 s = _CurrentTimeLocale->mon[(size_t)(item - MON_1)]; 73 break; 74 case ABMON_1: 75 case ABMON_2: 76 case ABMON_3: 77 case ABMON_4: 78 case ABMON_5: 79 case ABMON_6: 80 case ABMON_7: 81 case ABMON_8: 82 case ABMON_9: 83 case ABMON_10: 84 case ABMON_11: 85 case ABMON_12: 86 s = _CurrentTimeLocale->abmon[(size_t)(item - ABMON_1)]; 87 break; 88 case RADIXCHAR: 89 s = _CurrentNumericLocale->decimal_point; 90 break; 91 case THOUSEP: 92 s = _CurrentNumericLocale->thousands_sep; 93 break; 94 case YESSTR: 95 s = _CurrentMessagesLocale->yesstr; 96 break; 97 case YESEXPR: 98 s = _CurrentMessagesLocale->yesexpr; 99 break; 100 case NOSTR: 101 s = _CurrentMessagesLocale->nostr; 102 break; 103 case NOEXPR: 104 s = _CurrentMessagesLocale->noexpr; 105 break; 106 case CRNCYSTR: /* XXX */ 107 s = ""; 108 break; 109 case CODESET: 110 #ifdef WITH_RUNE 111 s = _CurrentRuneLocale->rl_codeset; 112 #else 113 s = NULL; 114 #endif 115 if (!s) 116 s = ""; 117 break; 118 default: 119 s = ""; 120 break; 121 } 122 123 /* The return value should be really const, but the interface says OW */ 124 return __UNCONST(s); 125 } 126