+2007-02-04 Bruno Haible <bruno@clisp.org>
+
+ New module mbscspn.
+ * modules/mbscspn: New file.
+ * lib/mbscspn.c: New file.
+ * lib/string_.h (strcspn): Add a conditional link warning.
+ (mbscspn): New declaration.
+ * m4/mbscspn.m4: New file.
+ * m4/string_h.m4 (gl_STRING_MODULE_INDICATOR_DEFAULTS): Initialize
+ GNULIB_MBSCSPN.
+ * modules/string (string.h): Also substitute GNULIB_MBSCSPN.
+ * MODULES.html.sh (Internationalization functions): Add mbscspn.
+
2007-02-04 Bruno Haible <bruno@clisp.org>
New module mbscasestr, reduced goal of strcasestr.
func_module mbsstr
func_module mbscasecmp
func_module mbscasestr
+ func_module mbscspn
func_module mbswidth
func_module memcasecmp
func_module memcoll
# define strnlen strnlen_is_unportable__use_gnulib_module_strnlen_for_portability
#endif
+#if defined GNULIB_POSIXCHECK
+/* strcspn() assumes the second argument is a list of single-byte characters.
+ Even in this simple case, it does not work with multibyte strings if the
+ locale encoding is GB18030 and one of the characters to be searched is a
+ digit. */
+# undef strcspn
+# define strcspn(s,a) \
+ (GL_LINK_WARNING ("strcspn cannot work correctly on character strings in multibyte locales - use mbscspn if you care about internationalization"), \
+ strcspn (s, a))
+#endif
+
/* Find the first occurrence in S of any character in ACCEPT. */
#if @GNULIB_STRPBRK@
# if ! @HAVE_STRPBRK@
extern char * mbscasestr (const char *haystack, const char *needle);
#endif
+#if @GNULIB_MBSCSPN@
+/* Find the first occurrence in the character string STRING of any character
+ in the character string ACCEPT. Return the number of bytes from the
+ beginning of the string to this occurrence, or to the end of the string
+ if none exists.
+ Unlike strcspn(), this function works correctly in multibyte locales. */
+extern size_t mbscspn (const char *string, const char *accept);
+#endif
+
#ifdef __cplusplus
}
GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR])
GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP])
GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR])
+ GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN])
])
-e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \
-e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \
-e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \
+ -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \
-e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \
-e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \
-e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \