From bdc255835ecd2a188ad4f20f8bed618a07204dc7 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sun, 25 Jun 2017 12:39:13 +0100 Subject: [PATCH] Provide a compatibility implementation of iswblank for C89 compilers. --- .gitignore | 1 + configure.ac | 1 + tests/printcdata.c | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index fdfc86f9..532cd277 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .*.swp +*~ # intermediate files: diff --git a/configure.ac b/configure.ac index c99d67ce..0a7e6665 100644 --- a/configure.ac +++ b/configure.ac @@ -24,6 +24,7 @@ dnl library checks. dnl ================================================================ AC_CHECK_HEADERS([stddef.h]) dnl C89 +AC_CHECK_FUNCS([iswblank]) dnl C99 AC_TYPE_UINT8_T AC_TYPE_UINT32_T diff --git a/tests/printcdata.c b/tests/printcdata.c index 09eaf1cd..6992bb94 100644 --- a/tests/printcdata.c +++ b/tests/printcdata.c @@ -17,6 +17,7 @@ * along with ucd-tools. If not, see . */ +#include "config.h" #include "ucd/ucd.h" #include @@ -25,6 +26,13 @@ #include #include +#ifndef HAVE_ISWBLANK +static int iswblank(wint_t c) +{ + return iswspace(c) && !(c >= 0x0A && c <= 0x0D); +} +#endif + void fput_utf8c(FILE *out, codepoint_t c) { if (c < 0x80)