diff options
author | A. Wilcox <awilcox@wilcox-tech.com> | 2020-08-10 23:39:29 +0000 |
---|---|---|
committer | A. Wilcox <awilcox@wilcox-tech.com> | 2020-08-10 23:39:29 +0000 |
commit | a093226d4d20bdf9189f67d668cb7981540f6aa3 (patch) | |
tree | bc97f855da1d3bad06d93d97a127ad07687a81e9 /libgcompat/wchar.c | |
parent | 715b50ecba88d8cb83166c86567a51b165846ce6 (diff) | |
parent | 93b7fedb31b6086d2b9fd966cb8bf17430a9a515 (diff) | |
download | gcompat-a093226d4d20bdf9189f67d668cb7981540f6aa3.tar.gz gcompat-a093226d4d20bdf9189f67d668cb7981540f6aa3.tar.bz2 gcompat-a093226d4d20bdf9189f67d668cb7981540f6aa3.tar.xz gcompat-a093226d4d20bdf9189f67d668cb7981540f6aa3.zip |
Merge branch 'master' into 'master'
Implement: __fwprintf_chk, wcstoul_l, wcstoul_l, wcstod_l
See merge request adelie/gcompat!7
Diffstat (limited to 'libgcompat/wchar.c')
-rw-r--r-- | libgcompat/wchar.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/libgcompat/wchar.c b/libgcompat/wchar.c index 4ed7a7b..930cc7c 100644 --- a/libgcompat/wchar.c +++ b/libgcompat/wchar.c @@ -5,6 +5,37 @@ int __vswprintf_chk(wchar_t *s, size_t n, int flag, size_t slen, const wchar_t *format, va_list ap); +int __vfwprintf_chk(FILE *fp, int flag, const wchar_t *format, va_list ap); + +/** + * Convert formatted wide-character output, with stack checking + * + * LSB 5.0: LSB-Core-generic/baselib---fwprintf-chk-1.html + */ +int __fwprintf_chk(FILE *stream, int flag, const wchar_t *format, ...) +{ + int ret; + va_list ap; + + va_start(ap, format); + ret = __vfwprintf_chk(stream, flag, format, ap); + va_end(ap); + + return ret; +} + +/** + * Convert formatted wide-character output, with stack checking + * + * LSB 5.0: LSB-Core-generic/baselib---vfwprintf-chk-1.html + */ +int __vfwprintf_chk(FILE *fp, int flag, const wchar_t *format, va_list ap) +{ + assert(fp != NULL); + assert(format != NULL); + + return vfwprintf(fp, format, ap); +} /** * Convert formatted wide-character output, with stack checking @@ -72,3 +103,35 @@ long int __wcstol_internal(const wchar_t *nptr, wchar_t **endptr, int base, assert(group == 0); return wcstol(nptr, endptr, base); } + +/** + * Convert a wide-character string to an unsigned long int. + * + * Some day, when musl supports LC_NUMERIC, we can probably remove this. + */ +unsigned long int wcstoul_l(const wchar_t *nptr, wchar_t **endptr, + int base, locale_t loc) +{ + return wcstoul(nptr, endptr, base); +} + +/** + * Convert a wide-character string to a long int. + * + * Some day, when musl supports LC_NUMERIC, we can probably remove this. + */ +long int wcstol_l(const wchar_t *nptr, wchar_t **endptr, int base, + locale_t loc) +{ + return wcstol(nptr, endptr, base); +} + +/** + * Convert a wide-character string to a double. + * + * Some day, when musl supports LC_NUMERIC, we can probably remove this. + */ +double wcstod_l(const wchar_t *nptr, wchar_t **endptr, locale_t loc) +{ + return wcstod(nptr, endptr); +} |