From: Rich Felker Date: Tue, 7 Feb 2012 02:51:02 +0000 (-0500) Subject: more locale_t interfaces (string stuff) and header updates X-Git-Tag: v0.8.5~25 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=36bf56940af90baa478dd1258884291d5d213d10;p=oweals%2Fmusl.git more locale_t interfaces (string stuff) and header updates this should be everything except for some functions where the non-_l version isn't even implemented yet (mainly some non-ISO-C wcs* functions). --- diff --git a/include/string.h b/include/string.h index a5b5a510..c2dc7e35 100644 --- a/include/string.h +++ b/include/string.h @@ -13,6 +13,11 @@ extern "C" { #endif #define __NEED_size_t +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) +#define __NEED_locale_t +#endif + #include void *memcpy (void *, const void *, size_t); @@ -57,6 +62,9 @@ size_t strnlen (const char *, size_t); char *strdup (const char *); char *strndup (const char *, size_t); char *strsignal(int); +char *strerror_l (int, locale_t); +int strcoll_l (const char *, const char *, locale_t); +size_t strxfrm_l (char *, const char *, size_t, locale_t); #endif #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) diff --git a/include/strings.h b/include/strings.h index aa35668c..345c6517 100644 --- a/include/strings.h +++ b/include/strings.h @@ -7,6 +7,7 @@ extern "C" { #define __NEED_size_t +#define __NEED_locale_t #include @@ -22,6 +23,9 @@ char *rindex (const char *, 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); + #ifdef __cplusplus } #endif diff --git a/include/time.h b/include/time.h index 557c8f4b..ddfad58f 100644 --- a/include/time.h +++ b/include/time.h @@ -23,6 +23,7 @@ extern "C" { #define __NEED_clockid_t #define __NEED_timer_t #define __NEED_pid_t +#define __NEED_locale_t #endif #include @@ -58,6 +59,8 @@ char *ctime (const time_t *); #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) +size_t strftime_l (char *, size_t, const char *, const struct tm *, locale_t); + struct tm *gmtime_r (const time_t *, struct tm *); struct tm *localtime_r (const time_t *, struct tm *); char *asctime_r (const struct tm *, char *); diff --git a/src/locale/nl_langinfo_l.c b/src/locale/nl_langinfo_l.c new file mode 100644 index 00000000..b54db95c --- /dev/null +++ b/src/locale/nl_langinfo_l.c @@ -0,0 +1,7 @@ +#include +#include + +char *nl_langinfo_l(nl_item item, locale_t l) +{ + return nl_langinfo(item); +} diff --git a/src/locale/strcasecmp_l.c b/src/locale/strcasecmp_l.c new file mode 100644 index 00000000..eea2f80b --- /dev/null +++ b/src/locale/strcasecmp_l.c @@ -0,0 +1,7 @@ +#include +#include + +int strcasecmp_l(const char *l, const char *r, locale_t loc) +{ + return strcasecmp(l, r); +} diff --git a/src/locale/strcoll_l.c b/src/locale/strcoll_l.c new file mode 100644 index 00000000..7948b0d1 --- /dev/null +++ b/src/locale/strcoll_l.c @@ -0,0 +1,7 @@ +#include +#include + +int strcoll_l(const char *l, const char *r, locale_t loc) +{ + return strcoll(l, r); +} diff --git a/src/locale/strerror_l.c b/src/locale/strerror_l.c new file mode 100644 index 00000000..765f5c69 --- /dev/null +++ b/src/locale/strerror_l.c @@ -0,0 +1,7 @@ +#include +#include + +char *strerror_l(int err, locale_t l) +{ + return strerror(err); +} diff --git a/src/locale/strftime_l.c b/src/locale/strftime_l.c new file mode 100644 index 00000000..70b2f151 --- /dev/null +++ b/src/locale/strftime_l.c @@ -0,0 +1,7 @@ +#include +#include + +size_t strftime_l(char *s, size_t n, const char *f, const struct tm *tm, locale_t l) +{ + return strftime(s, n, f, tm); +} diff --git a/src/locale/strncasecmp_l.c b/src/locale/strncasecmp_l.c new file mode 100644 index 00000000..af33ada6 --- /dev/null +++ b/src/locale/strncasecmp_l.c @@ -0,0 +1,7 @@ +#include +#include + +int strncasecmp_l(const char *l, const char *r, size_t n, locale_t loc) +{ + return strncasecmp(l, r, n); +} diff --git a/src/locale/strxfrm_l.c b/src/locale/strxfrm_l.c new file mode 100644 index 00000000..78e56554 --- /dev/null +++ b/src/locale/strxfrm_l.c @@ -0,0 +1,6 @@ +#include + +size_t strxfrm_l(char *dest, const char *src, size_t n, locale_t l) +{ + return strxfrm(dest, src, n); +}