summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/inttypes.h10
-rw-r--r--lib/libc/locale/Makefile.inc6
-rw-r--r--lib/libc/locale/wcstoimax.c19
-rw-r--r--lib/libc/locale/wcstoumax.c18
4 files changed, 49 insertions, 4 deletions
diff --git a/include/inttypes.h b/include/inttypes.h
index 78bd7f65946..8e26c3bf891 100644
--- a/include/inttypes.h
+++ b/include/inttypes.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: inttypes.h,v 1.9 2006/01/15 00:47:51 millert Exp $ */
+/* $OpenBSD: inttypes.h,v 1.10 2009/01/13 18:13:51 kettenis Exp $ */
/*
* Copyright (c) 1997, 2005 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -21,6 +21,10 @@
#include <sys/stdint.h>
+#ifdef __cplusplus
+#define __wchar_t wchar_t
+#endif
+
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
/*
* 7.8.1 Macros for format specifiers
@@ -252,6 +256,10 @@ intmax_t imaxabs(intmax_t);
imaxdiv_t imaxdiv(intmax_t, intmax_t);
intmax_t strtoimax(const char *, char **, int);
uintmax_t strtoumax(const char *, char **, int);
+intmax_t wcstoimax(const __wchar_t * __restrict,
+ __wchar_t ** __restrict, int);
+uintmax_t wcstoumax(const __wchar_t * __restrict,
+ __wchar_t ** __restrict, int);
__END_DECLS
#endif /* _INTTYPES_H_ */
diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc
index 2df2495699e..7436049c410 100644
--- a/lib/libc/locale/Makefile.inc
+++ b/lib/libc/locale/Makefile.inc
@@ -1,12 +1,12 @@
-# $OpenBSD: Makefile.inc,v 1.11 2008/12/20 23:08:08 kettenis Exp $
+# $OpenBSD: Makefile.inc,v 1.12 2009/01/13 18:13:51 kettenis Exp $
# locale sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/locale ${LIBCSRCDIR}/locale
SRCS+= _def_messages.c _def_monetary.c _def_numeric.c _def_time.c \
localeconv.c nl_langinfo.c setlocale.c iswctype.c mbrtowc_sb.c \
- multibyte_sb.c \
- __mb_cur_max.c wcstod.c wcstol.c wcstoul.c wcstoll.c wcstoull.c \
+ multibyte_sb.c __mb_cur_max.c wcstod.c \
+ wcstol.c wcstoul.c wcstoll.c wcstoull.c wcstoimax.c wcstoumax.c \
setrunelocale.c runeglue.c rune.c runetable.c ___runetype_mb.c \
_wctrans.c
diff --git a/lib/libc/locale/wcstoimax.c b/lib/libc/locale/wcstoimax.c
new file mode 100644
index 00000000000..d46a7c7c41a
--- /dev/null
+++ b/lib/libc/locale/wcstoimax.c
@@ -0,0 +1,19 @@
+/* $OpenBSD: wcstoimax.c,v 1.1 2009/01/13 18:13:51 kettenis Exp $ */
+/* $NetBSD: wcstol.c,v 1.2 2003/03/11 09:21:23 tshiozak Exp $ */
+
+#include <ctype.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "wctoint.h"
+
+#define FUNCNAME wcstoimax
+typedef intmax_t int_type;
+#define MIN_VALUE INTMAX_MIN
+#define MAX_VALUE INTMAX_MAX
+
+#include "_wcstol.h"
diff --git a/lib/libc/locale/wcstoumax.c b/lib/libc/locale/wcstoumax.c
new file mode 100644
index 00000000000..ccd471340ea
--- /dev/null
+++ b/lib/libc/locale/wcstoumax.c
@@ -0,0 +1,18 @@
+/* $OpenBSD: wcstoumax.c,v 1.1 2009/01/13 18:13:51 kettenis Exp $ */
+/* $NetBSD: wcstoul.c,v 1.2 2003/03/11 09:21:24 tshiozak Exp $ */
+
+#include <ctype.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include "wctoint.h"
+
+#define FUNCNAME wcstoumax
+typedef uintmax_t uint_type;
+#define MAX_VALUE UINTMAX_MAX
+
+#include "_wcstoul.h"