summaryrefslogtreecommitdiff
path: root/include/locale.h
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-09-05 03:16:15 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-09-05 03:16:15 +0000
commit9a429b0d2263bff179436e11aedd8607a30e445d (patch)
tree2e10dcca448d30a69a66b85e910591c02281a79d /include/locale.h
parent5fa20654190f944a2de98b5be63bb85423ae44b2 (diff)
New POSIX xlocale implementation written from scratch.
Complete in the sense that all POSIX *locale(3) and *_l(3) functions are included, but in OpenBSD, we of course only really care about LC_CTYPE and we only support ASCII and UTF-8. With important help from kettenis@, guenther@, and jca@. Repeated testing in ports bulk builds by naddy@. Additional testing by jca@, sebastia@, dcoppa@, and others. OK kettenis@ dcoppa@, and guenther@ on an earlier version. Riding guenther@'s libc/librthread major bump.
Diffstat (limited to 'include/locale.h')
-rw-r--r--include/locale.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/include/locale.h b/include/locale.h
index 38d7a408439..78189962df4 100644
--- a/include/locale.h
+++ b/include/locale.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: locale.h,v 1.10 2016/09/09 18:12:37 millert Exp $ */
+/* $OpenBSD: locale.h,v 1.11 2017/09/05 03:16:13 schwarze Exp $ */
/* $NetBSD: locale.h,v 1.6 1994/10/26 00:56:02 cgd Exp $ */
/*
@@ -76,9 +76,37 @@ struct lconv {
#include <sys/cdefs.h>
+#if __POSIX_VISIBLE >= 200809
+
+#ifndef _LOCALE_T_DEFINED_
+#define _LOCALE_T_DEFINED_
+typedef void *locale_t;
+#endif
+
+#define LC_COLLATE_MASK (1 << LC_COLLATE)
+#define LC_CTYPE_MASK (1 << LC_CTYPE)
+#define LC_MONETARY_MASK (1 << LC_MONETARY)
+#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
+#define LC_TIME_MASK (1 << LC_TIME)
+#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
+
+#define LC_ALL_MASK ((1 << _LC_LAST) - 2)
+
+#define LC_GLOBAL_LOCALE ((locale_t)-1)
+
+#endif /* __POSIX_VISIBLE >= 200809 */
+
+
__BEGIN_DECLS
struct lconv *localeconv(void);
char *setlocale(int, const char *);
+
+#if __POSIX_VISIBLE >= 200809
+locale_t duplocale(locale_t);
+void freelocale(locale_t);
+locale_t newlocale(int, const char *, locale_t);
+locale_t uselocale(locale_t);
+#endif
__END_DECLS
#endif /* _LOCALE_H_ */