[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
isascii
From: |
Simon Josefsson |
Subject: |
isascii |
Date: |
Fri, 12 Aug 2005 13:03:19 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
isascii is not part of C89, but POSIX:
http://www.opengroup.org/onlinepubs/009695399/functions/isascii.html
GnuTLS uses it. How about the patch below?
Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/ChangeLog,v
retrieving revision 1.325
diff -u -p -r1.325 ChangeLog
--- ChangeLog 12 Aug 2005 09:16:15 -0000 1.325
+++ ChangeLog 12 Aug 2005 11:02:07 -0000
@@ -1,5 +1,9 @@
2005-08-12 Simon Josefsson <address@hidden>
+ * modules/isascii: New file.
+
+2005-08-12 Simon Josefsson <address@hidden>
+
* MODULES.html.sh (Extra functions based on ANSI C 89: Misc): Add
readline, getdelim and check_version.
(Support for systems lacking ISO C 99: Sizes of integer types):
Index: lib/ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/ChangeLog,v
retrieving revision 1.900
diff -u -p -r1.900 ChangeLog
--- lib/ChangeLog 11 Aug 2005 19:42:27 -0000 1.900
+++ lib/ChangeLog 12 Aug 2005 11:02:08 -0000
@@ -1,3 +1,7 @@
+2005-08-12 Simon Josefsson <address@hidden>
+
+ * isascii.h, isascii.c: New file.
+
2005-08-11 Simon Josefsson <address@hidden>
* readline.h, readline.c: New file.
Index: lib/isascii.c
===================================================================
RCS file: lib/isascii.c
diff -N lib/isascii.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/isascii.c 12 Aug 2005 11:02:08 -0000
@@ -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 General Public License as published by
+ the Free Software Foundation; either version 2, 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 General Public License for more details.
+
+ You should have received a copy of the GNU 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;
+}
Index: lib/isascii.h
===================================================================
RCS file: lib/isascii.h
diff -N lib/isascii.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/isascii.h 12 Aug 2005 11:02:08 -0000
@@ -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 General Public License as published by
+ the Free Software Foundation; either version 2, 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 General Public License for more details.
+
+ You should have received a copy of the GNU 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 */
Index: m4/ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/ChangeLog,v
retrieving revision 1.685
diff -u -p -r1.685 ChangeLog
--- m4/ChangeLog 12 Aug 2005 07:57:44 -0000 1.685
+++ m4/ChangeLog 12 Aug 2005 11:02:09 -0000
@@ -1,5 +1,7 @@
2005-08-12 Simon Josefsson <address@hidden>
+ * isascii.m4: New file.
+
* readline.m4: Look for termcap, curses or ncurses if required.
2005-08-11 Simon Josefsson <address@hidden>
Index: m4/isascii.m4
===================================================================
RCS file: m4/isascii.m4
diff -N m4/isascii.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ m4/isascii.m4 12 Aug 2005 11:02:09 -0000
@@ -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], [:])
Index: modules/isascii
===================================================================
RCS file: modules/isascii
diff -N modules/isascii
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules/isascii 12 Aug 2005 11:02:09 -0000
@@ -0,0 +1,22 @@
+Description:
+isascii() function: test for a 7-bit US-ASCII character
+
+Files:
+lib/isascii.h
+lib/isascii.c
+m4/isascii.m4
+
+Depends-on:
+
+configure.ac:
+gl_FUNC_ISASCII
+
+Makefile.am:
+
+Include:
+
+License:
+LGPL
+
+Maintainer:
+Simon Josefsson
- isascii,
Simon Josefsson <=