+2006-07-28 Bruno Haible <bruno@clisp.org>
+
+ * mbchar.h (iswalnum, iswalpha, iswblank, iswcntrl, iswdigit, iswgraph,
+ iswlower, iswprint, iswpunct, iswspace, iswupper, iswxdigit): Define
+ fallbacks.
+ Avoids link error on FreeBSD 4.x.
+ Reported by Yoann Vandoorselaere <yoann.v@prelude-ids.com>.
+
+ * wcwidth.h (iswprint): Assume an ASCII compatible wide character
+ encoding.
+ * mbswidth.c (iswcntrl): Likewise.
+
2006-07-28 Paul Eggert <eggert@cs.ucla.edu>
* modechange.c (mode_compile): Numeric modes now affect setuid and
#include <wchar.h>
#include <wctype.h>
+/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
+ Assume all 12 functions are implemented the same way, or not at all. */
+#if !defined iswalnum && !HAVE_ISWCNTRL
+ststic inline int
+iswalnum (wint_t wc)
+{
+ return (wc >= 0 && wc < 128
+ ? (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')
+ : 0);
+}
+#endif
+#if !defined iswalpha && !HAVE_ISWCNTRL
+ststic inline int
+iswalpha (wint_t wc)
+{
+ return (wc >= 0 && wc < 128
+ ? (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'
+ : 0);
+}
+#endif
+#if !defined iswblank && !HAVE_ISWCNTRL
+ststic inline int
+iswblank (wint_t wc)
+{
+ return (wc >= 0 && wc < 128
+ ? wc == ' ' || wc == '\t'
+ : 0);
+}
+#endif
+#if !defined iswcntrl && !HAVE_ISWCNTRL
+ststic inline int
+iswcntrl (wint_t wc)
+{
+ return (wc >= 0 && wc < 128
+ ? (wc & ~0x1f) == 0 || wc == 0x7f
+ : 0);
+}
+#endif
+#if !defined iswdigit && !HAVE_ISWCNTRL
+ststic inline int
+iswdigit (wint_t wc)
+{
+ return (wc >= '0' && wc <= '9');
+}
+#endif
+#if !defined iswgraph && !HAVE_ISWCNTRL
+ststic inline int
+iswgraph (wint_t wc)
+{
+ return (wc >= 0 && wc < 128
+ ? wc >= '!' && wc <= '~'
+ : 1);
+}
+#endif
+#if !defined iswlower && !HAVE_ISWCNTRL
+ststic inline int
+iswlower (wint_t wc)
+{
+ return (wc >= 0 && wc < 128
+ ? wc >= 'a' && wc <= 'z'
+ : 0);
+}
+#endif
+#if !defined iswprint && !HAVE_ISWCNTRL
+ststic inline int
+iswprint (wint_t wc)
+{
+ return (wc >= 0 && wc < 128
+ ? wc >= ' ' && wc <= '~'
+ : 1);
+}
+#endif
+#if !defined iswpunct && !HAVE_ISWCNTRL
+ststic inline int
+iswpunct (wint_t wc)
+{
+ return (wc >= 0 && wc < 128
+ ? wc >= '!' && wc <= '~'
+ && !((wc >= '0' && wc <= '9')
+ || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'))
+ : 1);
+}
+#endif
+#if !defined iswspace && !HAVE_ISWCNTRL
+ststic inline int
+iswspace (wint_t wc)
+{
+ return (wc >= 0 && wc < 128
+ ? wc == ' ' || wc == '\t'
+ || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r'
+ : 0);
+}
+#endif
+#if !defined iswupper && !HAVE_ISWCNTRL
+ststic inline int
+iswupper (wint_t wc)
+{
+ return (wc >= 0 && wc < 128
+ ? wc >= 'A' && wc <= 'Z'
+ : 0);
+}
+#endif
+#if !defined iswxdigit && !HAVE_ISWCNTRL
+ststic inline int
+iswxdigit (wint_t wc)
+{
+ return (wc >= '0' && wc <= '9') || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F');
+}
+#endif
#include "wcwidth.h"
-# mbchar.m4 serial 2
-dnl Copyright (C) 2005 Free Software Foundation, Inc.
+# mbchar.m4 serial 3
+dnl Copyright (C) 2005-2006 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl Compile mbchar.c only if HAVE_WCHAR_H && HAVE_WCTYPE_H.
if test $ac_cv_header_wchar_h = yes && test $ac_cv_header_wctype_h = yes; then
AC_LIBOBJ([mbchar])
+ dnl Prerequisites of mbchar.h and mbchar.c.
+ AC_CHECK_FUNCS([iswcntrl])
fi
])