]> sjero.net Git - wget/blobdiff - src/safe-ctype.h
Updated licensing exception for OpenSSL from the SFLC.
[wget] / src / safe-ctype.h
index d5fc649051a3c10ed62acfe0de16f4dc3be3d968..efc13967c1e406d0e22096e6b40e66ac89137e3b 100644 (file)
@@ -7,7 +7,7 @@ This file is part of the libiberty library.
 Libiberty is free software; you can redistribute it and/or
 modify it under the terms of the GNU Library General Public
 License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
+version 3 of the License, or (at your option) any later version.
 
 Libiberty is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,9 +15,19 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 Library General Public License for more details.
 
 You should have received a copy of the GNU Library General Public
-License along with libiberty; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+License along with libiberty.  If not, see
+<http://www.gnu.org/licenses/>.
+
+Additional permission under GNU GPL version 3 section 7
+
+If you modify this program, or any covered work, by linking or
+combining it with the OpenSSL project's OpenSSL library (or a
+modified version of that library), containing parts covered by the
+terms of the OpenSSL or SSLeay licenses, the Free Software Foundation
+grants you additional permission to convey the resulting work.
+Corresponding Source for a non-source form of such a combination
+shall include the source code for the parts of OpenSSL used as well
+as that of the covered work.  */
 
 /* This is a compatible replacement of the standard C library's <ctype.h>
    with the following properties:
@@ -35,9 +45,30 @@ Boston, MA 02111-1307, USA.  */
 #ifndef SAFE_CTYPE_H
 #define SAFE_CTYPE_H
 
-#ifdef isalpha
- #error "safe-ctype.h and ctype.h may not be used simultaneously"
-#else
+/* Catch erroneous use of ctype macros.  Files that really know what
+   they're doing can disable this check by defining the
+   I_REALLY_WANT_CTYPE_MACROS preprocessor constant. */
+
+#ifndef I_REALLY_WANT_CTYPE_MACROS
+
+/* We used to #define these to errors, but that loses when real
+   ctype.h is included, usually by a library's (OpenSSL's) header
+   which gets #included after wget.h.  */
+
+#undef isalpha
+#undef isalnum
+#undef isblank
+#undef iscntrl
+#undef isdigit
+#undef isgraph
+#undef islower
+#undef isprint
+#undef ispunct
+#undef isspace
+#undef isupper
+#undef isxdigit
+
+#endif /* I_REALLY_WANT_CTYPE_MACROS */
 
 /* Categories.  */
 
@@ -69,7 +100,7 @@ enum {
 /* Character classification.  */
 extern const unsigned short _sch_istable[256];
 
-#define _sch_test(c, bit) (_sch_istable[(c) & 0xff] & (bit))
+#define _sch_test(c, bit) (_sch_istable[(c) & 0xff] & (unsigned short)(bit))
 
 #define ISALPHA(c)  _sch_test(c, _sch_isalpha)
 #define ISALNUM(c)  _sch_test(c, _sch_isalnum)
@@ -96,5 +127,4 @@ extern const unsigned char  _sch_tolower[256];
 #define TOUPPER(c) _sch_toupper[(c) & 0xff]
 #define TOLOWER(c) _sch_tolower[(c) & 0xff]
 
-#endif /* no ctype.h */
 #endif /* SAFE_CTYPE_H */