]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
isascii compat
authorMatthijs Mekking <matje@NLnetLabs.nl>
Tue, 1 Mar 2011 12:44:33 +0000 (12:44 +0000)
committerMatthijs Mekking <matje@NLnetLabs.nl>
Tue, 1 Mar 2011 12:44:33 +0000 (12:44 +0000)
Makefile.in
compat/isascii.c [new file with mode: 0644]
configure.ac

index 4cd40d0245ef3d00b70a2c100be568d01cba4ae1..6e0ce40641bc241be67975611e7fcb076f38cc89 100644 (file)
@@ -315,6 +315,9 @@ timegm$U.o: $(srcdir)/compat/timegm.c
 isblank$U.o:   $(srcdir)/compat/isblank.c
        $(COMP_LIB) -c $(srcdir)/compat/isblank.c -o $@
 
+isasciik$U.o:  $(srcdir)/compat/isascii.c
+       $(COMP_LIB) -c $(srcdir)/compat/isascii.c -o $@
+
 strlcpy$U.o:   $(srcdir)/compat/strlcpy.c
        $(COMP_LIB) -c $(srcdir)/compat/strlcpy.c -o $@
 
diff --git a/compat/isascii.c b/compat/isascii.c
new file mode 100644 (file)
index 0000000..759904c
--- /dev/null
@@ -0,0 +1,15 @@
+/* Just a replacement, if the original isascii is not
+   present */
+
+#if HAVE_CONFIG_H
+#include <ldns/config.h>
+#endif
+
+int isascii(int c);
+
+/* true if character is a blank (space or tab). C99. */
+int
+isascii(int c)
+{
+       return c >= 0 && c < 128;
+}
index f81dba6cebf4ec777a226bf1a3c447693b0a43e8..0eec1fa9f5747ffed8166ddc4a4c2704c8175e48 100644 (file)
@@ -312,6 +312,7 @@ AC_REPLACE_FUNCS(timegm)
 AC_REPLACE_FUNCS(gmtime_r)
 AC_REPLACE_FUNCS(ctime_r)
 AC_REPLACE_FUNCS(isblank)
+AC_REPLACE_FUNCS(isascii)
 AC_REPLACE_FUNCS(inet_aton)
 AC_REPLACE_FUNCS(inet_pton)
 AC_REPLACE_FUNCS(inet_ntop)
@@ -444,6 +445,9 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result);
 #ifndef HAVE_ISBLANK
 int isblank(int c);
 #endif /* !HAVE_ISBLANK */
+#ifndef HAVE_ISASCII
+int isascii(int c);
+#endif /* !HAVE_ISBLANK */
 #ifndef HAVE_SNPRINTF
 #include <stdarg.h>
 int snprintf (char *str, size_t count, const char *fmt, ...);