diff options
author | Simon Josefsson <simon@josefsson.org> | 2005-08-12 11:04:45 +0000 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2005-08-12 11:04:45 +0000 |
commit | ab392d7887e74590ab05ed2d72d6dd302d6ca232 (patch) | |
tree | 726eb15f2f21be0ca3a0a5699a156a4c340de476 | |
parent | 83d950f80dcb8e80f2282f62d70f43efb6466bd7 (diff) | |
download | gnutls-ab392d7887e74590ab05ed2d72d6dd302d6ca232.tar.gz |
Use isascii from gnulib.
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | gl/Makefile.am | 2 | ||||
-rw-r--r-- | gl/isascii.c | 29 | ||||
-rw-r--r-- | gl/isascii.h | 30 | ||||
-rw-r--r-- | gl/m4/gnulib.m4 | 3 | ||||
-rw-r--r-- | gl/m4/isascii.m4 | 19 | ||||
-rw-r--r-- | lib/defines.h | 7 |
7 files changed, 83 insertions, 9 deletions
diff --git a/configure.in b/configure.in index 7de25bfb8f..0c0148fb5e 100644 --- a/configure.in +++ b/configure.in @@ -461,7 +461,7 @@ AC_MSG_RESULT([*** gl_SOURCE_BASE(gl) gl_M4_BASE(gl/m4) -gl_MODULES(getline error memmem getpass-gnu minmax snprintf memmove) +gl_MODULES(getline error memmem getpass-gnu minmax snprintf memmove isascii) gl_LGPL gl_INIT diff --git a/gl/Makefile.am b/gl/Makefile.am index 965b74c8af..9969d8fb7b 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -9,7 +9,7 @@ # # Generated by gnulib-tool. # Invoked as: gnulib-tool --import -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --aux-dir=. --libtool --lgpl alloca-opt error getdelim getline getpass-gnu memmem memmove minmax size_max snprintf stdbool vasnprintf xsize +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --aux-dir=. --libtool --lgpl alloca-opt error getdelim getline getpass-gnu isascii memmem memmove minmax size_max snprintf stdbool vasnprintf xsize AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies diff --git a/gl/isascii.c b/gl/isascii.c new file mode 100644 index 0000000000..d6be982335 --- /dev/null +++ b/gl/isascii.c @@ -0,0 +1,29 @@ +/* Test for a 7-bit US-ASCII character. + Copyright (C) 2005 Free Software Foundation, Inc. + Written by Simon Josefsson. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#include "isascii.h" + +int +isascii (int c) +{ + return (c & ~0x7f) == 0; +} diff --git a/gl/isascii.h b/gl/isascii.h new file mode 100644 index 0000000000..c9f060bea2 --- /dev/null +++ b/gl/isascii.h @@ -0,0 +1,30 @@ +/* Test for a 7-bit US-ASCII character. + Copyright (C) 2005 Free Software Foundation, Inc. + Written by Simon Josefsson. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef ISASCII_H +#define ISASCII_H + +/* Get isascii declaration, if available. */ +#include <ctype.h> + +#if defined HAVE_DECL_ISASCII && !HAVE_DECL_ISASCII +/* Test whether C is a 7-bit US-ASCII character code. */ +extern int isascii(int c); +#endif + +#endif /* ISASCII_H */ diff --git a/gl/m4/gnulib.m4 b/gl/m4/gnulib.m4 index bfd013173e..f537c5679b 100644 --- a/gl/m4/gnulib.m4 +++ b/gl/m4/gnulib.m4 @@ -8,7 +8,7 @@ # Generated by gnulib-tool. # # Invoked as: gnulib-tool --import -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --aux-dir=. --libtool --lgpl alloca-opt error getdelim getline getpass-gnu memmem memmove minmax size_max snprintf stdbool vasnprintf xsize +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --aux-dir=. --libtool --lgpl alloca-opt error getdelim getline getpass-gnu isascii memmem memmove minmax size_max snprintf stdbool vasnprintf xsize AC_DEFUN([gl_EARLY], [ @@ -22,6 +22,7 @@ AC_DEFUN([gl_INIT], gl_FUNC_GETDELIM gl_FUNC_GETLINE gl_FUNC_GETPASS_GNU + gl_FUNC_ISASCII gl_FUNC_MEMMEM gl_FUNC_MEMMOVE gl_MINMAX diff --git a/gl/m4/isascii.m4 b/gl/m4/isascii.m4 new file mode 100644 index 0000000000..70b77e2e51 --- /dev/null +++ b/gl/m4/isascii.m4 @@ -0,0 +1,19 @@ +# isascii.m4 serial 1 +dnl Copyright (C) 2005 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. + +AC_DEFUN([gl_FUNC_ISASCII], +[ + AC_LIBSOURCES([isascii.h, isascii.c]) + + dnl Persuade glibc <ctype.h> to declare isascii(). + AC_REQUIRE([AC_GNU_SOURCE]) + + AC_REPLACE_FUNCS(isascii) + AC_CHECK_DECLS_ONCE(isascii) +]) + +# Prerequisites of lib/isascii.h. +AC_DEFUN([gl_PREREQ_ISASCII], [:]) diff --git a/lib/defines.h b/lib/defines.h index 21cedc0fbf..e89dc2a22c 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -72,6 +72,7 @@ typedef int ssize_t; #endif #include "memmem.h" +#include "isascii.h" #ifndef HAVE_UINT typedef unsigned int uint; @@ -87,12 +88,6 @@ typedef struct { unsigned char i[8]; } uint64; -#ifndef HAVE_ISASCII -# ifndef isascii -# define isascii(x) (x<128?1:0) -# endif -#endif - #if SIZEOF_UNSIGNED_LONG == 4 typedef unsigned long int uint32; typedef signed long int sint32; |