diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ctype.h | 114 | ||||
-rw-r--r-- | include/langinfo.h | 13 | ||||
-rw-r--r-- | include/locale.h | 30 | ||||
-rw-r--r-- | include/stdlib.h | 7 | ||||
-rw-r--r-- | include/string.h | 13 | ||||
-rw-r--r-- | include/strings.h | 11 | ||||
-rw-r--r-- | include/time.h | 15 | ||||
-rw-r--r-- | include/wchar.h | 13 | ||||
-rw-r--r-- | include/wctype.h | 31 |
9 files changed, 234 insertions, 13 deletions
diff --git a/include/ctype.h b/include/ctype.h index 13ade6c2c87..e90d375c8d2 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ctype.h,v 1.24 2014/05/26 01:49:36 guenther Exp $ */ +/* $OpenBSD: ctype.h,v 1.25 2017/09/05 03:16:13 schwarze Exp $ */ /* $NetBSD: ctype.h,v 1.14 1994/10/26 00:55:47 cgd Exp $ */ /* @@ -51,6 +51,13 @@ #define _X 0x40 #define _B 0x80 +#if __POSIX_VISIBLE >= 200809 +#ifndef _LOCALE_T_DEFINED_ +#define _LOCALE_T_DEFINED_ +typedef void *locale_t; +#endif +#endif + __BEGIN_DECLS extern const char *_ctype_; @@ -84,9 +91,26 @@ int _tolower(int); int _toupper(int); #endif /* __BSD_VISIBLE || __XPG_VISIBLE */ +#if __POSIX_VISIBLE >= 200809 +int isalnum_l(int, locale_t); +int isalpha_l(int, locale_t); +int isblank_l(int, locale_t); +int iscntrl_l(int, locale_t); +int isdigit_l(int, locale_t); +int isgraph_l(int, locale_t); +int islower_l(int, locale_t); +int isprint_l(int, locale_t); +int ispunct_l(int, locale_t); +int isspace_l(int, locale_t); +int isupper_l(int, locale_t); +int isxdigit_l(int, locale_t); +int tolower_l(int, locale_t); +int toupper_l(int, locale_t); +#endif + #endif /* __GNUC__ || _ANSI_LIBRARY */ -#if !defined(_ANSI_LIBRARY) +#if !defined(_ANSI_LIBRARY) && !defined(__cplusplus) __only_inline int isalnum(int _c) { @@ -187,6 +211,92 @@ __only_inline int _toupper(int _c) } #endif /* __BSD_VISIBLE || __XPG_VISIBLE */ +#if __POSIX_VISIBLE >= 200809 +__only_inline int +isalnum_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return isalnum(_c); +} + +__only_inline int +isalpha_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return isalpha(_c); +} + +__only_inline int +isblank_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return isblank(_c); +} + +__only_inline int +iscntrl_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return iscntrl(_c); +} + +__only_inline int +isdigit_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return isdigit(_c); +} + +__only_inline int +isgraph_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return isgraph(_c); +} + +__only_inline int +islower_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return islower(_c); +} + +__only_inline int +isprint_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return isprint(_c); +} + +__only_inline int +ispunct_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return ispunct(_c); +} + +__only_inline int +isspace_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return isspace(_c); +} + +__only_inline int +isupper_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return isupper(_c); +} + +__only_inline int +isxdigit_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return isxdigit(_c); +} + +__only_inline int +tolower_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return tolower(_c); +} + +__only_inline int +toupper_l(int _c, locale_t _l __attribute__((__unused__))) +{ + return toupper(_c); +} +#endif /* __POSIX_VISIBLE >= 200809 */ + #endif /* !_ANSI_LIBRARY */ __END_DECLS diff --git a/include/langinfo.h b/include/langinfo.h index 62443094c59..dd37bfce30f 100644 --- a/include/langinfo.h +++ b/include/langinfo.h @@ -1,4 +1,4 @@ -/* $OpenBSD: langinfo.h,v 1.7 2012/12/05 23:19:57 deraadt Exp $ */ +/* $OpenBSD: langinfo.h,v 1.8 2017/09/05 03:16:13 schwarze Exp $ */ /* $NetBSD: langinfo.h,v 1.3 1995/04/28 23:30:54 jtc Exp $ */ /* @@ -70,8 +70,19 @@ #define CODESET 51 /* Codeset name */ +#if __POSIX_VISIBLE >= 200809 +#ifndef _LOCALE_T_DEFINED_ +#define _LOCALE_T_DEFINED_ +typedef void *locale_t; +#endif +#endif + __BEGIN_DECLS char *nl_langinfo(nl_item); + +#if __POSIX_VISIBLE >= 200809 +char *nl_langinfo_l(nl_item, locale_t); +#endif __END_DECLS #endif /* _LANGINFO_H_ */ 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_ */ diff --git a/include/stdlib.h b/include/stdlib.h index 0374313a112..cc359ab32e1 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdlib.h,v 1.71 2017/05/11 11:52:18 tom Exp $ */ +/* $OpenBSD: stdlib.h,v 1.72 2017/09/05 03:16:13 schwarze Exp $ */ /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ /*- @@ -82,8 +82,7 @@ typedef struct { #define RAND_MAX 0x7fffffff -extern size_t __mb_cur_max; -#define MB_CUR_MAX __mb_cur_max +#define MB_CUR_MAX __mb_cur_max() /* * Some header files may define an abs macro. @@ -132,7 +131,7 @@ unsigned long strtoul(const char *__restrict, char **__restrict, int); int system(const char *); -/* these are currently just stubs */ +size_t __mb_cur_max(void); int mblen(const char *, size_t); size_t mbstowcs(wchar_t *, const char *, size_t); int wctomb(char *, wchar_t); diff --git a/include/string.h b/include/string.h index b4c880ce3ac..9141c300004 100644 --- a/include/string.h +++ b/include/string.h @@ -1,4 +1,4 @@ -/* $OpenBSD: string.h,v 1.31 2016/09/09 18:12:37 millert Exp $ */ +/* $OpenBSD: string.h,v 1.32 2017/09/05 03:16:13 schwarze Exp $ */ /* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */ /*- @@ -52,6 +52,13 @@ typedef __size_t size_t; #endif +#if __POSIX_VISIBLE >= 200809 +#ifndef _LOCALE_T_DEFINED_ +#define _LOCALE_T_DEFINED_ +typedef void *locale_t; +#endif +#endif + __BEGIN_DECLS void *memchr(const void *, int, size_t); int memcmp(const void *, const void *, size_t); @@ -102,9 +109,13 @@ char *strdup(const char *); #if __POSIX_VISIBLE >= 200809 char *stpcpy(char *__restrict, const char *__restrict); char *stpncpy(char *__restrict, const char *__restrict, size_t); +int strcoll_l(const char *, const char *, locale_t); +char *strerror_l(int, locale_t); char *strndup(const char *, size_t); size_t strnlen(const char *, size_t); char *strsignal(int); +size_t strxfrm_l(char *__restrict, const char *__restrict, size_t, locale_t) + __attribute__ ((__bounded__(__string__,1,3))); #endif #if __BSD_VISIBLE diff --git a/include/strings.h b/include/strings.h index c9d4856da55..7108bbe041e 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1,4 +1,4 @@ -/* $OpenBSD: strings.h,v 1.4 2015/11/20 23:40:32 millert Exp $ */ +/* $OpenBSD: strings.h,v 1.5 2017/09/05 03:16:13 schwarze Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -47,6 +47,13 @@ typedef __size_t size_t; #endif +#if __POSIX_VISIBLE >= 200809 +#ifndef _LOCALE_T_DEFINED_ +#define _LOCALE_T_DEFINED_ +typedef void *locale_t; +#endif +#endif + __BEGIN_DECLS #if __BSD_VISIBLE || (__XPG_VISIBLE >= 420 && __POSIX_VISIBLE <= 200112) /* @@ -66,6 +73,8 @@ char *rindex(const char *, int); int ffs(int); int strcasecmp(const char *, const char *); int strncasecmp(const char *, const char *, size_t); +int strcasecmp_l(const char *, const char *, locale_t); +int strncasecmp_l(const char *, const char *, size_t, locale_t); #endif __END_DECLS diff --git a/include/time.h b/include/time.h index a73f9c3a6cc..fc9121e631d 100644 --- a/include/time.h +++ b/include/time.h @@ -1,4 +1,4 @@ -/* $OpenBSD: time.h,v 1.29 2016/09/09 18:12:37 millert Exp $ */ +/* $OpenBSD: time.h,v 1.30 2017/09/05 03:16:13 schwarze Exp $ */ /* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */ /* @@ -99,6 +99,13 @@ typedef __pid_t pid_t; #endif #endif +#if __POSIX_VISIBLE >= 200809 +#ifndef _LOCALE_T_DEFINED_ +#define _LOCALE_T_DEFINED_ +typedef void *locale_t; +#endif +#endif + struct tm { int tm_sec; /* seconds after the minute [0-60] */ int tm_min; /* minutes after the hour [0-59] */ @@ -160,6 +167,12 @@ int nanosleep(const struct timespec *, struct timespec *); int clock_getcpuclockid(pid_t, clockid_t *); #endif +#if __POSIX_VISIBLE >= 200809 +size_t strftime_l(char *__restrict, size_t, const char *__restrict, + const struct tm *__restrict, locale_t) + __attribute__ ((__bounded__(__string__,1,2))); +#endif + #if __BSD_VISIBLE void tzsetwall(void); time_t timelocal(struct tm *); diff --git a/include/wchar.h b/include/wchar.h index 7cdee59a0b8..309f812d65b 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wchar.h,v 1.30 2016/09/09 18:12:37 millert Exp $ */ +/* $OpenBSD: wchar.h,v 1.31 2017/09/05 03:16:13 schwarze Exp $ */ /* $NetBSD: wchar.h,v 1.16 2003/03/07 07:11:35 tshiozak Exp $ */ /*- @@ -96,6 +96,13 @@ typedef __size_t size_t; #define WCHAR_MAX 0x7fffffff #endif +#if __POSIX_VISIBLE >= 200809 +#ifndef _LOCALE_T_DEFINED_ +#define _LOCALE_T_DEFINED_ +typedef void *locale_t; +#endif +#endif + __BEGIN_DECLS wint_t btowc(int); size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict); @@ -155,9 +162,13 @@ unsigned long int wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, #if __POSIX_VISIBLE >= 200809 FILE *open_wmemstream(wchar_t **, size_t *); +int wcscoll_l(const wchar_t *, const wchar_t *, locale_t); wchar_t *wcsdup(const wchar_t *); int wcscasecmp(const wchar_t *, const wchar_t *); +int wcscasecmp_l(const wchar_t *, const wchar_t *, locale_t); int wcsncasecmp(const wchar_t *, const wchar_t *, size_t); +int wcsncasecmp_l(const wchar_t *, const wchar_t *, size_t, locale_t); +size_t wcsxfrm_l(wchar_t *, const wchar_t *, size_t, locale_t); size_t mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t, size_t, mbstate_t * __restrict) diff --git a/include/wctype.h b/include/wctype.h index 5d4e55738e5..bf61d255779 100644 --- a/include/wctype.h +++ b/include/wctype.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wctype.h,v 1.5 2006/01/06 18:53:04 millert Exp $ */ +/* $OpenBSD: wctype.h,v 1.6 2017/09/05 03:16:13 schwarze Exp $ */ /* $NetBSD: wctype.h,v 1.5 2003/03/02 22:18:11 tshiozak Exp $ */ /*- @@ -54,6 +54,13 @@ typedef __wctype_t wctype_t; #define WEOF ((wint_t)-1) #endif +#if __POSIX_VISIBLE >= 200809 +#ifndef _LOCALE_T_DEFINED_ +#define _LOCALE_T_DEFINED_ +typedef void *locale_t; +#endif +#endif + __BEGIN_DECLS int iswalnum(wint_t); int iswalpha(wint_t); @@ -73,6 +80,28 @@ wint_t towlower(wint_t); wint_t towupper(wint_t); wctrans_t wctrans(const char *); wctype_t wctype(const char *); + +#if __POSIX_VISIBLE >= 200809 +int iswalnum_l(wint_t, locale_t); +int iswalpha_l(wint_t, locale_t); +int iswblank_l(wint_t, locale_t); +int iswcntrl_l(wint_t, locale_t); +int iswdigit_l(wint_t, locale_t); +int iswgraph_l(wint_t, locale_t); +int iswlower_l(wint_t, locale_t); +int iswprint_l(wint_t, locale_t); +int iswpunct_l(wint_t, locale_t); +int iswspace_l(wint_t, locale_t); +int iswupper_l(wint_t, locale_t); +int iswxdigit_l(wint_t, locale_t); +int iswctype_l(wint_t, wctype_t, locale_t); +wint_t towctrans_l(wint_t, wctrans_t, locale_t); +wint_t towlower_l(wint_t, locale_t); +wint_t towupper_l(wint_t, locale_t); +wctrans_t wctrans_l(const char *, locale_t); +wctype_t wctype_l(const char *, locale_t); +#endif + __END_DECLS #endif /* _WCTYPE_H_ */ |