+2008-12-19 Bruno Haible <bruno@clisp.org>
+
+ New module 'mbrlen'.
+ * lib/wchar.in.h (mbrlen): New declaration.
+ * lib/mbrlen.c: New file.
+ * m4/mbrlen.m4: New file.
+ * modules/mbrlen: New file.
+ * m4/wchar.m4 (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_MBRLEN and
+ HAVE_MBRLEN.
+ * modules/wchar (Makefile.am): Substitute GNULIB_MBRLEN and
+ HAVE_MBRLEN.
+ * doc/posix-functions/mbrlen.texi: Document the new module.
+
2008-12-19 Bruno Haible <bruno@clisp.org>
* lib/mbrtowc.c: Include verify.h. Verify an assumption.
POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/mbrlen.html}
-Gnulib module: ---
+Gnulib module: mbrlen
Portability problems fixed by Gnulib:
@itemize
+@item
+This function is missing on some platforms:
+HP-UX 11, IRIX 6.5, Solaris 2.6, mingw, Interix 3.5.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
-@item
-This function is missing on some platforms:
-HP-UX 11, IRIX 6.5, Solaris 2.6, mingw, Interix 3.5.
@end itemize
#endif
+/* Recognize a multibyte character. */
+#if @GNULIB_MBRLEN@
+# if !@HAVE_MBRLEN@
+extern size_t mbrlen (const char *s, size_t n, mbstate_t *ps);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mbrlen
+# define mbrlen(s,n,p) \
+ (GL_LINK_WARNING ("mbrlen is unportable - " \
+ "use gnulib module mbrlen for portability"), \
+ mbrlen (s, n, p))
+#endif
+
+
/* Return the number of screen columns needed for WC. */
#if @GNULIB_WCWIDTH@
# if @REPLACE_WCWIDTH@
dnl Written by Eric Blake.
-# wchar.m4 serial 9
+# wchar.m4 serial 10
AC_DEFUN([gl_WCHAR_H],
[
GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB])
GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT])
GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC])
+ GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN])
GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC])
HAVE_WCTOB=1; AC_SUBST([HAVE_WCTOB])
HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT])
HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC])
+ HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN])
HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
WCHAR_H=''; AC_SUBST([WCHAR_H])
-e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \
-e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \
-e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \
+ -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \
-e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
-e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
-e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
-e 's|@''HAVE_WCTOB''@|$(HAVE_WCTOB)|g' \
-e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
-e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
+ -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
-e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
-e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \