aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2001-09-19 05:33:36 +0000
committerH.J. Lu <hjl.tools@gmail.com>2001-09-19 05:33:36 +0000
commit3882b010780ca1aa1ed5d7b38e936cd2d6d5486b (patch)
treec806a73a13afd3265ba6b538ba73cae065c591f5 /binutils
parent6b819c92c4512ccfba90f0caa204ab687fae8254 (diff)
downloadgdb-3882b010780ca1aa1ed5d7b38e936cd2d6d5486b.zip
gdb-3882b010780ca1aa1ed5d7b38e936cd2d6d5486b.tar.gz
gdb-3882b010780ca1aa1ed5d7b38e936cd2d6d5486b.tar.bz2
Locale changes from Bruno Haible <haible@clisp.cons.org>.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog56
-rw-r--r--binutils/addr2line.c6
-rw-r--r--binutils/ar.c3
-rw-r--r--binutils/coffdump.c3
-rw-r--r--binutils/dlltool.c9
-rw-r--r--binutils/dllwrap.c12
-rw-r--r--binutils/nlmconv.c10
-rw-r--r--binutils/nlmheader.y21
-rw-r--r--binutils/nm.c3
-rw-r--r--binutils/objcopy.c3
-rw-r--r--binutils/objdump.c11
-rw-r--r--binutils/rclex.l14
-rw-r--r--binutils/rcparse.y13
-rw-r--r--binutils/readelf.c3
-rw-r--r--binutils/resrc.c18
-rw-r--r--binutils/size.c5
-rw-r--r--binutils/srconv.c3
-rw-r--r--binutils/stabs.c50
-rw-r--r--binutils/strings.c13
-rw-r--r--binutils/sysdump.c8
-rw-r--r--binutils/windres.c17
-rw-r--r--binutils/winduni.c7
-rw-r--r--binutils/wrstabs.c6
23 files changed, 191 insertions, 103 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index b659091..e25add5 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,59 @@
+2001-09-18 Bruno Haible <haible@clisp.cons.org>
+
+ * addr2line.c: Don't include <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * ar.c (main): Likewise.
+ * coffdump.c (main): Likewise.
+ * dlltool.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ Use ISALNUM instead of isalpha/isdigit.
+ * dllwrap.c: Don't include <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * nlmconv.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ Use TOUPPER instead of islower/toupper.
+ * nlmheader.y: Include "safe-ctype.h" instead of <ctype.h>.
+ (yylex): Use ISSPACE/ISALNUM instead of isspace/isalnum.
+ Use TOUPPER instead of islower/toupper.
+ * nm.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * objcopy.c (main): Likewise.
+ * objdump.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (disassemble_bytes): Use ISPRINT instead of isprint.
+ (dump_section_stabs): Use ISDIGIT instead of isdigit.
+ (dump_data): Use ISPRINT instead of isprint.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * rclex.l: Include "safe-ctype.h" instead of <ctype.h>.
+ (cpp_line, handle_quotes): Use ISSPACE instead of isspace.
+ * rcparse.y: Include "safe-ctype.h" instead of <ctype.h>.
+ Use TOUPPER instead of islower/toupper.
+ * readelf.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * resrc.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (write_rc_accelerators): Use ISPRINT instead of isprint.
+ (write_rc_rcdata): Likewise.
+ * size.c (main): For gettext, also set the LC_CTYPE locate facet.
+ * srconv.c (main): Likewise.
+ * stabs.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (parse_number): Use ISDIGIT/ISUPPER/ISLOWER instead of
+ isdigit/isupper/islower.
+ (parse_stab_string, parse_stab_type, parse_stab_argtypes,
+ parse_stab_array_type, stab_demangle_count, stab_demangle_get_count,
+ stab_demangle_prefix, stab_demangle_qualified,
+ stab_demangle_template, stab_demangle_type,
+ stab_demangle_fund_type): Use ISDIGIT instead of isdigit.
+ * strings.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (isgraphic): Use ISPRINT instead of isascii/isprint.
+ (main): Remove HAVE_LC_MESSAGES dependency.
+ * sysdump.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (pbarray): Use ISPRINT instead of isprint.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * windres.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (format_from_filename): Use ISPRINT instead of isprint.
+ (main): For gettext, also set the LC_CTYPE locate facet.
+ * winduni.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (unicode_print): Use ISPRINT instead of isprint.
+ * wrstabs.c: Include "safe-ctype.h" instead of <ctype.h>.
+ (stab_variable): Use ISDIGIT instead of isdigit.
+
2001-09-18 Alan Modra <amodra@bigpond.net.au>
* ar.c (print_contents): Cast args of bfd_seek to the right types.
diff --git a/binutils/addr2line.c b/binutils/addr2line.c
index daae503..6315887 100644
--- a/binutils/addr2line.c
+++ b/binutils/addr2line.c
@@ -1,5 +1,5 @@
/* addr2line.c -- convert addresses to line number and function name
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Ulrich Lauther <Ulrich.Lauther@mchp.siemens.de>
This file is part of GNU Binutils.
@@ -28,7 +28,6 @@
both forms write results to stdout, the second form reads addresses
to be converted from stdin. */
-#include <ctype.h>
#include <string.h>
#include "bfd.h"
@@ -278,6 +277,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/ar.c b/binutils/ar.c
index c0732f0..fe46b91 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -379,6 +379,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/coffdump.c b/binutils/coffdump.c
index 42a1e70..0bd39f4 100644
--- a/binutils/coffdump.c
+++ b/binutils/coffdump.c
@@ -493,6 +493,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/dlltool.c b/binutils/dlltool.c
index 4295e0a..6723060 100644
--- a/binutils/dlltool.c
+++ b/binutils/dlltool.c
@@ -1,5 +1,5 @@
/* dlltool.c -- tool to generate stuff for PE style DLLs
- Copyright 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -253,8 +253,8 @@
#include "demangle.h"
#include "dyn-string.h"
#include "dlltool.h"
+#include "safe-ctype.h"
-#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
@@ -3220,6 +3220,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -3386,7 +3389,7 @@ main (ac, av)
imp_name_lab = xstrdup (imp_name);
for (p = imp_name_lab; *p; p++)
{
- if (!isalpha ((unsigned char) *p) && !isdigit ((unsigned char) *p))
+ if (!ISALNUM (*p))
*p = '_';
}
head_label = make_label("_head_", imp_name_lab);
diff --git a/binutils/dllwrap.c b/binutils/dllwrap.c
index 8f83dda..fb92cb2 100644
--- a/binutils/dllwrap.c
+++ b/binutils/dllwrap.c
@@ -1,5 +1,5 @@
/* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Mumit Khan (khan@xraylith.wisc.edu).
This file is part of GNU Binutils.
@@ -36,7 +36,6 @@
#include "getopt.h"
#include "dyn-string.h"
-#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
@@ -664,6 +663,15 @@ main (argc, argv)
program_name = argv[0];
+#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+ setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
saved_argv = (char **) xmalloc (argc * sizeof (char*));
dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int));
driver_arg_indices = (int *) xmalloc (argc * sizeof (int));
diff --git a/binutils/nlmconv.c b/binutils/nlmconv.c
index 9c7dd37..64284da 100644
--- a/binutils/nlmconv.c
+++ b/binutils/nlmconv.c
@@ -1,5 +1,5 @@
/* nlmconv.c -- NLM conversion program
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -35,10 +35,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "libiberty.h"
#include "bucomm.h"
+#include "safe-ctype.h"
#include <ansidecl.h>
#include <time.h>
-#include <ctype.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <assert.h>
@@ -214,6 +214,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
@@ -1071,8 +1074,7 @@ main (argc, argv)
for (modname = nlm_fixed_header (outbfd)->moduleName;
*modname != '\0';
modname++)
- if (islower ((unsigned char) *modname))
- *modname = toupper (*modname);
+ *modname = TOUPPER (*modname);
strncpy (nlm_variable_header (outbfd)->oldThreadName, " LONG",
NLM_OLD_THREAD_NAME_LENGTH);
diff --git a/binutils/nlmheader.y b/binutils/nlmheader.y
index 3ab5a79..5d83f31 100644
--- a/binutils/nlmheader.y
+++ b/binutils/nlmheader.y
@@ -1,5 +1,5 @@
%{/* nlmheader.y - parse NLM header specification keywords.
- Copyright 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1997, 1998, 2001 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ansidecl.h>
#include <stdio.h>
-#include <ctype.h>
+#include "safe-ctype.h"
#include "bfd.h"
#include "bucomm.h"
#include "nlm/common.h"
@@ -682,7 +682,7 @@ tail_recurse:
c = getc (current.file);
/* Commas are treated as whitespace characters. */
- while (isspace ((unsigned char) c) || c == ',')
+ while (ISSPACE (c) || c == ',')
{
current.state = IN_LINE;
if (c == '\n')
@@ -735,9 +735,9 @@ tail_recurse:
if (c == '\n')
++current.lineno;
}
- while (isspace ((unsigned char) c));
+ while (ISSPACE (c));
BUF_INIT ();
- while (! isspace ((unsigned char) c) && c != EOF)
+ while (! ISSPACE (c) && c != EOF)
{
BUF_ADD (c);
c = getc (current.file);
@@ -755,17 +755,14 @@ tail_recurse:
if (current.state == BEGINNING_OF_LINE)
{
BUF_INIT ();
- while (isalnum ((unsigned char) c) || c == '_')
+ while (ISALNUM (c) || c == '_')
{
- if (islower ((unsigned char) c))
- BUF_ADD (toupper ((unsigned char) c));
- else
- BUF_ADD (c);
+ BUF_ADD (TOUPPER (c));
c = getc (current.file);
}
BUF_FINISH ();
- if (c != EOF && ! isspace ((unsigned char) c) && c != ',')
+ if (c != EOF && ! ISSPACE (c) && c != ',')
{
nlmheader_identify ();
fprintf (stderr, _("%s:%d: illegal character in keyword: %c\n"),
@@ -838,7 +835,7 @@ tail_recurse:
/* Gather a generic argument. */
BUF_INIT ();
- while (! isspace (c)
+ while (! ISSPACE (c)
&& c != ','
&& c != COMMENT_CHAR
&& c != '('
diff --git a/binutils/nm.c b/binutils/nm.c
index c422e9b..e6cc368 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -405,6 +405,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 160f28b..4be1d59 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2611,6 +2611,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 168f246..5020040 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -23,7 +23,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "getopt.h"
#include "progress.h"
#include "bucomm.h"
-#include <ctype.h>
+#include "safe-ctype.h"
#include "dis-asm.h"
#include "libiberty.h"
#include "demangle.h"
@@ -1345,7 +1345,7 @@ disassemble_bytes (info, disassemble_fn, insns, data,
for (j = addr_offset * opb; j < addr_offset * opb + octets; ++j)
{
- if (isprint (data[j]))
+ if (ISPRINT (data[j]))
buf[j - addr_offset * opb] = data[j];
else
buf[j - addr_offset * opb] = '.';
@@ -1999,7 +1999,7 @@ dump_section_stabs (abfd, stabsect_name, strsect_name)
match or a section followed by a number. */
if (strncmp (stabsect_name, s->name, len) == 0
&& (s->name[len] == '\000'
- || isdigit ((unsigned char) s->name[len])))
+ || ISDIGIT (s->name[len])))
{
if (read_section_stabs (abfd, s->name, strsect_name))
{
@@ -2286,7 +2286,7 @@ dump_data (abfd)
if (j >= stop_offset * opb)
printf (" ");
else
- printf ("%c", isprint (data[j]) ? data[j] : '.');
+ printf ("%c", ISPRINT (data[j]) ? data[j] : '.');
}
putchar ('\n');
}
@@ -2766,6 +2766,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/rclex.l b/binutils/rclex.l
index d05d1c0..c9073e2 100644
--- a/binutils/rclex.l
+++ b/binutils/rclex.l
@@ -1,5 +1,5 @@
%{ /* rclex.l -- lexer for Windows rc files parser */
-/* Copyright 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -26,10 +26,10 @@
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "windres.h"
#include "rcparse.h"
-#include <ctype.h>
#include <assert.h>
/* Whether we are in rcdata mode, in which we returns the lengths of
@@ -252,18 +252,18 @@ cpp_line (s)
char *send, *fn;
++s;
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
line = strtol (s, &send, 0);
- if (*send != '\0' && ! isspace ((unsigned char) *send))
+ if (*send != '\0' && ! ISSPACE (*send))
return;
/* Subtract 1 because we are about to count the newline. */
rc_lineno = line - 1;
s = send;
- while (isspace ((unsigned char) *s))
+ while (ISSPACE (*s))
++s;
if (*s != '"')
@@ -423,8 +423,8 @@ handle_quotes (input, len)
else
{
++t;
- assert (isspace ((unsigned char) *t));
- while (isspace ((unsigned char) *t))
+ assert (ISSPACE (*t));
+ while (ISSPACE (*t))
++t;
if (*t == '\0')
break;
diff --git a/binutils/rcparse.y b/binutils/rcparse.y
index f2378c0..152c8ee 100644
--- a/binutils/rcparse.y
+++ b/binutils/rcparse.y
@@ -1,5 +1,5 @@
%{ /* rcparse.y -- parser for Windows rc files
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -26,8 +26,7 @@
#include "bucomm.h"
#include "libiberty.h"
#include "windres.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
/* The current language. */
@@ -245,7 +244,7 @@ acc_event:
$$.flags = ACC_CONTROL | ACC_VIRTKEY;
++s;
ch = *s;
- ch = toupper ((unsigned char) ch);
+ ch = TOUPPER (ch);
}
$$.key = ch;
if (s[1] != '\0')
@@ -1259,8 +1258,7 @@ id:
/* It seems that resource ID's are forced to upper case. */
copy = xstrdup ($1);
for (s = copy; *s != '\0'; s++)
- if (islower ((unsigned char) *s))
- *s = toupper ((unsigned char) *s);
+ *s = TOUPPER (*s);
res_string_to_id (&$$, copy);
free (copy);
}
@@ -1297,8 +1295,7 @@ resref:
/* It seems that resource ID's are forced to upper case. */
copy = xstrdup ($1);
for (s = copy; *s != '\0'; s++)
- if (islower ((unsigned char) *s))
- *s = toupper ((unsigned char) *s);
+ *s = TOUPPER (*s);
res_string_to_id (&$$, copy);
free (copy);
}
diff --git a/binutils/readelf.c b/binutils/readelf.c
index cf3c2c2..eced501 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -9012,6 +9012,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/resrc.c b/binutils/resrc.c
index a29a664..eb7db96 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -1,5 +1,5 @@
/* resrc.c -- read and write Windows rc files.
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -25,10 +25,10 @@
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "windres.h"
#include <assert.h>
-#include <ctype.h>
#include <errno.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
@@ -1976,7 +1976,7 @@ write_rc_accelerators (e, accelerators)
fprintf (e, " ");
if ((acc->key & 0x7f) == acc->key
- && isprint ((unsigned char) acc->key)
+ && ISPRINT (acc->key)
&& (acc->flags & ACC_VIRTKEY) == 0)
{
fprintf (e, "\"%c\"", acc->key);
@@ -2383,7 +2383,7 @@ write_rc_rcdata (e, rcdata, ind)
s = ri->u.string.s;
for (i = 0; i < ri->u.string.length; i++)
{
- if (isprint ((unsigned char) *s))
+ if (ISPRINT (*s))
putc (*s, e);
else
fprintf (e, "\\%03o", *s);
@@ -2421,7 +2421,7 @@ write_rc_rcdata (e, rcdata, ind)
if (i + 4 < ri->u.buffer.length || ri->next != NULL)
fprintf (e, ",");
for (j = 0; j < 4; ++j)
- if (! isprint (ri->u.buffer.data[i + j])
+ if (! ISPRINT (ri->u.buffer.data[i + j])
&& ri->u.buffer.data[i + j] != 0)
break;
if (j >= 4)
@@ -2429,7 +2429,7 @@ write_rc_rcdata (e, rcdata, ind)
fprintf (e, "\t// ");
for (j = 0; j < 4; ++j)
{
- if (! isprint (ri->u.buffer.data[i + j]))
+ if (! ISPRINT (ri->u.buffer.data[i + j]))
fprintf (e, "\\%03o", ri->u.buffer.data[i + j]);
else
{
@@ -2455,7 +2455,7 @@ write_rc_rcdata (e, rcdata, ind)
if (i + 2 < ri->u.buffer.length || ri->next != NULL)
fprintf (e, ",");
for (j = 0; j < 2; ++j)
- if (! isprint (ri->u.buffer.data[i + j])
+ if (! ISPRINT (ri->u.buffer.data[i + j])
&& ri->u.buffer.data[i + j] != 0)
break;
if (j >= 2)
@@ -2463,7 +2463,7 @@ write_rc_rcdata (e, rcdata, ind)
fprintf (e, "\t// ");
for (j = 0; j < 2; ++j)
{
- if (! isprint (ri->u.buffer.data[i + j]))
+ if (! ISPRINT (ri->u.buffer.data[i + j]))
fprintf (e, "\\%03o", ri->u.buffer.data[i + j]);
else
{
@@ -2483,7 +2483,7 @@ write_rc_rcdata (e, rcdata, ind)
if (! first)
indent (e, ind + 2);
if ((ri->u.buffer.data[i] & 0x7f) == ri->u.buffer.data[i]
- && isprint (ri->u.buffer.data[i]))
+ && ISPRINT (ri->u.buffer.data[i]))
fprintf (e, "\"%c\"", ri->u.buffer.data[i]);
else
fprintf (e, "\"\\%03o\"", ri->u.buffer.data[i]);
diff --git a/binutils/size.c b/binutils/size.c
index 47a91ad..4344242 100644
--- a/binutils/size.c
+++ b/binutils/size.c
@@ -1,5 +1,5 @@
/* size.c -- report size of various sections of an executable file.
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@@ -113,6 +113,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/srconv.c b/binutils/srconv.c
index a60be25..9a40f16 100644
--- a/binutils/srconv.c
+++ b/binutils/srconv.c
@@ -1965,6 +1965,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/stabs.c b/binutils/stabs.c
index 8045140..bbc0632 100644
--- a/binutils/stabs.c
+++ b/binutils/stabs.c
@@ -26,11 +26,11 @@
trying to identify the correct address for anything. */
#include <stdio.h>
-#include <ctype.h>
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "demangle.h"
#include "debug.h"
#include "budbg.h"
@@ -307,11 +307,11 @@ parse_number (pp, poverflow)
int d;
d = *p++;
- if (isdigit ((unsigned char) d))
+ if (ISDIGIT (d))
d -= '0';
- else if (isupper ((unsigned char) d))
+ else if (ISUPPER (d))
d -= 'A';
- else if (islower ((unsigned char) d))
+ else if (ISLOWER (d))
d -= 'a';
else
break;
@@ -781,7 +781,7 @@ parse_stab_string (dhandle, info, stabtype, desc, value, string)
}
++p;
- if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-')
+ if (ISDIGIT (*p) || *p == '(' || *p == '-')
type = 'l';
else
type = *p++;
@@ -1185,7 +1185,7 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
/* Read type number if present. The type number may be omitted.
for instance in a two-dimensional array declared with type
"ar1;1;10;ar1;1;10;4". */
- if (! isdigit ((unsigned char) **pp) && **pp != '(' && **pp != '-')
+ if (! ISDIGIT (**pp) && **pp != '(' && **pp != '-')
{
/* 'typenums=' not present, type is anonymous. Read and return
the definition, but don't put it in the type vector. */
@@ -1228,7 +1228,7 @@ parse_stab_type (dhandle, info, typename, pp, slotp)
const char *p = *pp + 1;
const char *attr;
- if (isdigit ((unsigned char) *p) || *p == '(' || *p == '-')
+ if (ISDIGIT (*p) || *p == '(' || *p == '-')
{
/* Member type. */
break;
@@ -2913,7 +2913,7 @@ parse_stab_argtypes (dhandle, info, class_type, fieldname, tagname,
/* Constructors are sometimes handled specially. */
is_full_physname_constructor = ((argtypes[0] == '_'
&& argtypes[1] == '_'
- && (isdigit ((unsigned char) argtypes[2])
+ && (ISDIGIT (argtypes[2])
|| argtypes[2] == 'Q'
|| argtypes[2] == 't'))
|| strncmp (argtypes, "__ct", 4) == 0);
@@ -3149,7 +3149,7 @@ parse_stab_array_type (dhandle, info, pp, stringp)
adjustable = false;
- if (! isdigit ((unsigned char) **pp) && **pp != '-')
+ if (! ISDIGIT (**pp) && **pp != '-')
{
++*pp;
adjustable = true;
@@ -3163,7 +3163,7 @@ parse_stab_array_type (dhandle, info, pp, stringp)
}
++*pp;
- if (! isdigit ((unsigned char) **pp) && **pp != '-')
+ if (! ISDIGIT (**pp) && **pp != '-')
{
++*pp;
adjustable = true;
@@ -3772,7 +3772,7 @@ stab_demangle_count (pp)
unsigned int count;
count = 0;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
{
count *= 10;
count += **pp - '0';
@@ -3789,12 +3789,12 @@ stab_demangle_get_count (pp, pi)
const char **pp;
unsigned int *pi;
{
- if (! isdigit ((unsigned char) **pp))
+ if (! ISDIGIT (**pp))
return false;
*pi = **pp - '0';
++*pp;
- if (isdigit ((unsigned char) **pp))
+ if (ISDIGIT (**pp))
{
unsigned int count;
const char *p;
@@ -3807,7 +3807,7 @@ stab_demangle_get_count (pp, pi)
count += *p - '0';
++p;
}
- while (isdigit ((unsigned char) *p));
+ while (ISDIGIT (*p));
if (*p == '_')
{
*pp = p + 1;
@@ -3902,7 +3902,7 @@ stab_demangle_prefix (minfo, pp)
scan += i - 2;
if (scan == *pp
- && (isdigit ((unsigned char) scan[2])
+ && (ISDIGIT (scan[2])
|| scan[2] == 'Q'
|| scan[2] == 't'))
{
@@ -3911,7 +3911,7 @@ stab_demangle_prefix (minfo, pp)
return true;
}
else if (scan == *pp
- && ! isdigit ((unsigned char) scan[2])
+ && ! ISDIGIT (scan[2])
&& scan[2] != 't')
{
/* Look for the `__' that separates the prefix from the
@@ -4126,13 +4126,13 @@ stab_demangle_qualified (minfo, pp, ptype)
preceded by an underscore (to distinguish it from the <= 9
case) and followed by an underscore. */
p = *pp + 2;
- if (! isdigit ((unsigned char) *p) || *p == '0')
+ if (! ISDIGIT (*p) || *p == '0')
{
stab_bad_demangle (orig);
return false;
}
qualifiers = atoi (p);
- while (isdigit ((unsigned char) *p))
+ while (ISDIGIT (*p))
++p;
if (*p != '_')
{
@@ -4397,7 +4397,7 @@ stab_demangle_template (minfo, pp, pname)
{
if (**pp == 'm')
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
}
else if (charp)
@@ -4428,18 +4428,18 @@ stab_demangle_template (minfo, pp, pname)
{
if (**pp == 'm')
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
if (**pp == '.')
{
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
}
if (**pp == 'e')
{
++*pp;
- while (isdigit ((unsigned char) **pp))
+ while (ISDIGIT (**pp))
++*pp;
}
}
@@ -4692,7 +4692,7 @@ stab_demangle_type (minfo, pp, ptype)
high = 0;
while (**pp != '\0' && **pp != '_')
{
- if (! isdigit ((unsigned char) **pp))
+ if (! ISDIGIT (**pp))
{
stab_bad_demangle (orig);
return false;
@@ -4796,7 +4796,7 @@ stab_demangle_type (minfo, pp, ptype)
varargs = false;
++*pp;
- if (isdigit ((unsigned char) **pp))
+ if (ISDIGIT (**pp))
{
n = stab_demangle_count (pp);
if (strlen (*pp) < n)
@@ -5106,7 +5106,7 @@ stab_demangle_fund_type (minfo, pp, ptype)
case 'G':
++*pp;
- if (! isdigit ((unsigned char) **pp))
+ if (! ISDIGIT (**pp))
{
stab_bad_demangle (orig);
return false;
diff --git a/binutils/strings.c b/binutils/strings.c
index 7326cae..c6cf10d 100644
--- a/binutils/strings.c
+++ b/binutils/strings.c
@@ -59,10 +59,10 @@
#include "bfd.h"
#include <stdio.h>
#include <getopt.h>
-#include <ctype.h>
#include <errno.h>
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
/* Some platforms need to put stdin into binary mode, to read
binary files. */
@@ -81,14 +81,7 @@
#endif
#endif
-/* Not all printable characters have ASCII codes (depending upon the
- LOCALE set) but on some older systems it is not safe to test isprint
- without first testing isascii... */
-#if defined isascii && !defined HAVE_LOCALE_H
-#define isgraphic(c) (isascii (c) && (isprint (c) || (c) == '\t'))
-#else
-#define isgraphic(c) (isprint (c) || (c) == '\t')
-#endif
+#define isgraphic(c) (ISPRINT (c) || (c) == '\t')
#ifndef errno
extern int errno;
@@ -153,7 +146,7 @@ main (argc, argv)
int exit_status = 0;
boolean files_given = false;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#if defined (HAVE_SETLOCALE)
setlocale (LC_ALL, "");
#endif
bindtextdomain (PACKAGE, LOCALEDIR);
diff --git a/binutils/sysdump.c b/binutils/sysdump.c
index 28fafea..874b9e5 100644
--- a/binutils/sysdump.c
+++ b/binutils/sysdump.c
@@ -26,9 +26,9 @@
#include "bfd.h"
#include "bucomm.h"
+#include "safe-ctype.h"
#include <stdio.h>
-#include <ctype.h>
#include <libiberty.h>
#include <getopt.h>
#include "sysroff.h"
@@ -260,7 +260,8 @@ pbarray (y)
printf ("%d (", y->len);
for (x = 0; x < y->len; x++)
{
- printf ("(%02x %c)", y->data[x], isprint (y->data[x]) ? y->data[x] : '.');
+ printf ("(%02x %c)", y->data[x],
+ ISPRINT (y->data[x]) ? y->data[x] : '.');
}
printf (")\n");
}
@@ -760,6 +761,9 @@ main (ac, av)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/windres.c b/binutils/windres.c
index d76f35e..f802706 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -1,5 +1,5 @@
/* windres.c -- a program to manipulate Windows resources
- Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -39,11 +39,11 @@
#include "getopt.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "obstack.h"
#include "windres.h"
#include <assert.h>
-#include <ctype.h>
#include <time.h>
/* used by resrc.c at least */
@@ -679,11 +679,11 @@ format_from_filename (filename, input)
return RES_FORMAT_RES;
/* If every character is printable or space, assume it's an RC file. */
- if ((isprint (b1) || isspace (b1))
- && (isprint (b2) || isspace (b2))
- && (isprint (b3) || isspace (b3))
- && (isprint (b4) || isspace (b4))
- && (isprint (b5) || isspace (b5)))
+ if ((ISPRINT (b1) || ISSPACE (b1))
+ && (ISPRINT (b2) || ISSPACE (b2))
+ && (ISPRINT (b3) || ISSPACE (b3))
+ && (ISPRINT (b4) || ISSPACE (b4))
+ && (ISPRINT (b5) || ISSPACE (b5)))
return RES_FORMAT_RC;
/* Otherwise, we give up. */
@@ -789,6 +789,9 @@ main (argc, argv)
#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
setlocale (LC_MESSAGES, "");
#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
diff --git a/binutils/winduni.c b/binutils/winduni.c
index d79f47a..deb6a94 100644
--- a/binutils/winduni.c
+++ b/binutils/winduni.c
@@ -1,5 +1,5 @@
/* winduni.c -- unicode support for the windres program.
- Copyright 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -30,8 +30,7 @@
#include "bfd.h"
#include "bucomm.h"
#include "winduni.h"
-
-#include <ctype.h>
+#include "safe-ctype.h"
#ifdef _WIN32
#include <windows.h>
@@ -99,7 +98,7 @@ unicode_print (e, unicode, length)
{
if (ch == '\\')
fputs ("\\", e);
- else if (isprint (ch))
+ else if (ISPRINT (ch))
putc (ch, e);
else
{
diff --git a/binutils/wrstabs.c b/binutils/wrstabs.c
index 0b29511..4f10e0d 100644
--- a/binutils/wrstabs.c
+++ b/binutils/wrstabs.c
@@ -1,5 +1,5 @@
/* wrstabs.c -- Output stabs debugging information
- Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
@@ -23,12 +23,12 @@
information. */
#include <stdio.h>
-#include <ctype.h>
#include <assert.h>
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "safe-ctype.h"
#include "debug.h"
#include "budbg.h"
@@ -2172,7 +2172,7 @@ stab_variable (p, name, kind, val)
kindstr = "";
/* Make sure that this is a type reference or definition. */
- if (! isdigit ((unsigned char) *s))
+ if (! ISDIGIT (*s))
{
char *n;
long index;