Changeset 7f9df7b9 in mainline for uspace/lib/posix/src/locale.c
- Timestamp:
- 2018-01-22T22:42:57Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7a08c70
- Parents:
- e0f47f5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/src/locale.c
re0f47f5 r7f9df7b9 33 33 */ 34 34 35 #define LIBPOSIX_INTERNAL36 #define __POSIX_DEF__(x) posix_##x37 38 35 #include "internal/common.h" 39 36 #include "posix/locale.h" … … 54 51 }; 55 52 56 const struct posix_lconv C_LOCALE = {53 const struct lconv C_LOCALE = { 57 54 .currency_symbol = (char *) "", 58 55 .decimal_point = (char *) ".", … … 88 85 * @return Original locale name on success, NULL on failure. 89 86 */ 90 char * posix_setlocale(int category, const char *locale)87 char *setlocale(int category, const char *locale) 91 88 { 92 89 // TODO 93 90 if (locale == NULL || *locale == '\0' || 94 posix_strcmp(locale, "C") == 0) {91 strcmp(locale, "C") == 0) { 95 92 return (char *) "C"; 96 93 } … … 103 100 * @return Information about the current locale. 104 101 */ 105 struct posix_lconv *posix_localeconv(void)102 struct lconv *localeconv(void) 106 103 { 107 104 // TODO 108 return (struct posix_lconv *) &C_LOCALE;105 return (struct lconv *) &C_LOCALE; 109 106 } 110 107 … … 115 112 * @return Duplicated object. 116 113 */ 117 posix_locale_t posix_duplocale(posix_locale_t locobj)114 locale_t duplocale(locale_t locobj) 118 115 { 119 116 if (locobj == NULL) { … … 121 118 return NULL; 122 119 } 123 posix_locale_t copy = malloc(sizeof(struct __posix_locale));120 locale_t copy = malloc(sizeof(struct __posix_locale)); 124 121 if (copy == NULL) { 125 122 errno = ENOMEM; … … 135 132 * @param locobj Object to free. 136 133 */ 137 void posix_freelocale(posix_locale_t locobj)134 void freelocale(locale_t locobj) 138 135 { 139 136 if (locobj) { … … 150 147 * @return The new/modified locale object. 151 148 */ 152 posix_locale_t posix_newlocale(int category_mask, const char *locale,153 posix_locale_t base)149 locale_t newlocale(int category_mask, const char *locale, 150 locale_t base) 154 151 { 155 152 if (locale == NULL || … … 159 156 } 160 157 // TODO 161 posix_locale_t new = malloc(sizeof(struct __posix_locale));158 locale_t new = malloc(sizeof(struct __posix_locale)); 162 159 if (new == NULL) { 163 160 errno = ENOMEM; … … 165 162 } 166 163 if (base != NULL) { 167 posix_freelocale(base);164 freelocale(base); 168 165 } 169 166 return new; … … 176 173 * @return The previously set locale or LC_GLOBAL_LOCALE 177 174 */ 178 posix_locale_t posix_uselocale(posix_locale_t newloc)175 locale_t uselocale(locale_t newloc) 179 176 { 180 177 // TODO
Note:
See TracChangeset
for help on using the changeset viewer.