summaryrefslogtreecommitdiff
path: root/binutils/strings.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2002-11-30 08:39:46 +0000
committerAlan Modra <amodra@bigpond.net.au>2002-11-30 08:39:46 +0000
commit21bd0c8d7a860a284f4f85a72fc26721ec87aedd (patch)
tree9a0470dbae9d01002a20b39e95a68f81bb4eaaa8 /binutils/strings.c
parentfdb71d9a52a1eaa32d8b51672f63abe50896d4a0 (diff)
downloadbinutils-redhat-21bd0c8d7a860a284f4f85a72fc26721ec87aedd.tar.gz
s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. Simplify
comparisons of bfd_boolean vars with TRUE/FALSE. Formatting.
Diffstat (limited to 'binutils/strings.c')
-rw-r--r--binutils/strings.c100
1 files changed, 53 insertions, 47 deletions
diff --git a/binutils/strings.c b/binutils/strings.c
index dade244418..f1222e0c3f 100644
--- a/binutils/strings.c
+++ b/binutils/strings.c
@@ -107,17 +107,17 @@ static int address_radix;
/* Minimum length of sequence of graphic chars to trigger output. */
static int string_min;
-/* true means print address within file for each string. */
-static boolean print_addresses;
+/* TRUE means print address within file for each string. */
+static bfd_boolean print_addresses;
-/* true means print filename for each string. */
-static boolean print_filenames;
+/* TRUE means print filename for each string. */
+static bfd_boolean print_filenames;
-/* true means for object files scan only the data section. */
-static boolean datasection_only;
+/* TRUE means for object files scan only the data section. */
+static bfd_boolean datasection_only;
-/* true if we found an initialized data section in the current file. */
-static boolean got_a_section;
+/* TRUE if we found an initialized data section in the current file. */
+static bfd_boolean got_a_section;
/* The BFD object file format. */
static char *target;
@@ -139,18 +139,24 @@ static struct option long_options[] =
{NULL, 0, NULL, 0}
};
-static void strings_a_section PARAMS ((bfd *, asection *, PTR));
-static boolean strings_object_file PARAMS ((const char *));
-static boolean strings_file PARAMS ((char *file));
-static int integer_arg PARAMS ((char *s));
-static void print_strings PARAMS ((const char *filename, FILE *stream,
- file_off address, int stop_point,
- int magiccount, char *magic));
-static void usage PARAMS ((FILE *stream, int status));
-static long get_char PARAMS ((FILE *stream, file_off *address,
- int *magiccount, char **magic));
+static void strings_a_section
+ PARAMS ((bfd *, asection *, PTR));
+static bfd_boolean strings_object_file
+ PARAMS ((const char *));
+static bfd_boolean strings_file
+ PARAMS ((char *file));
+static int integer_arg
+ PARAMS ((char *s));
+static void print_strings
+ PARAMS ((const char *filename, FILE *stream, file_off address,
+ int stop_point, int magiccount, char *magic));
+static void usage
+ PARAMS ((FILE *stream, int status));
+static long get_char
+ PARAMS ((FILE *stream, file_off *address, int *magiccount, char **magic));
-int main PARAMS ((int, char **));
+int main
+ PARAMS ((int, char **));
int
main (argc, argv)
@@ -159,7 +165,7 @@ main (argc, argv)
{
int optc;
int exit_status = 0;
- boolean files_given = false;
+ bfd_boolean files_given = FALSE;
#if defined (HAVE_SETLOCALE)
setlocale (LC_ALL, "");
@@ -170,9 +176,9 @@ main (argc, argv)
program_name = argv[0];
xmalloc_set_program_name (program_name);
string_min = -1;
- print_addresses = false;
- print_filenames = false;
- datasection_only = true;
+ print_addresses = FALSE;
+ print_filenames = FALSE;
+ datasection_only = TRUE;
target = NULL;
encoding = 's';
@@ -182,11 +188,11 @@ main (argc, argv)
switch (optc)
{
case 'a':
- datasection_only = false;
+ datasection_only = FALSE;
break;
case 'f':
- print_filenames = true;
+ print_filenames = TRUE;
break;
case 'H':
@@ -202,12 +208,12 @@ main (argc, argv)
break;
case 'o':
- print_addresses = true;
+ print_addresses = TRUE;
address_radix = 8;
break;
case 't':
- print_addresses = true;
+ print_addresses = TRUE;
if (optarg[1] != '\0')
usage (stderr, 1);
switch (optarg[0])
@@ -281,28 +287,28 @@ main (argc, argv)
if (optind >= argc)
{
- datasection_only = false;
+ datasection_only = FALSE;
#ifdef SET_BINARY
SET_BINARY (fileno (stdin));
#endif
print_strings ("{standard input}", stdin, 0, 0, 0, (char *) NULL);
- files_given = true;
+ files_given = TRUE;
}
else
{
for (; optind < argc; ++optind)
{
if (strcmp (argv[optind], "-") == 0)
- datasection_only = false;
+ datasection_only = FALSE;
else
{
- files_given = true;
- exit_status |= (strings_file (argv[optind]) == false);
+ files_given = TRUE;
+ exit_status |= strings_file (argv[optind]) == FALSE;
}
}
}
- if (files_given == false)
+ if (!files_given)
usage (stderr, 1);
return (exit_status);
@@ -326,7 +332,7 @@ strings_a_section (abfd, sect, filearg)
PTR mem = xmalloc (sz);
if (bfd_get_section_contents (abfd, sect, mem, (file_ptr) 0, sz))
{
- got_a_section = true;
+ got_a_section = TRUE;
print_strings (file, (FILE *) NULL, sect->filepos, 0, sz, mem);
}
free (mem);
@@ -336,10 +342,10 @@ strings_a_section (abfd, sect, filearg)
/* Scan all of the sections in FILE, and print the strings
in the initialized data section(s).
- Return true if successful,
- false if not (such as if FILE is not an object file). */
+ Return TRUE if successful,
+ FALSE if not (such as if FILE is not an object file). */
-static boolean
+static bfd_boolean
strings_object_file (file)
const char *file;
{
@@ -348,33 +354,33 @@ strings_object_file (file)
if (abfd == NULL)
{
/* Treat the file as a non-object file. */
- return false;
+ return FALSE;
}
/* This call is mainly for its side effect of reading in the sections.
We follow the traditional behavior of `strings' in that we don't
complain if we don't recognize a file to be an object file. */
- if (bfd_check_format (abfd, bfd_object) == false)
+ if (!bfd_check_format (abfd, bfd_object))
{
bfd_close (abfd);
- return false;
+ return FALSE;
}
- got_a_section = false;
+ got_a_section = FALSE;
bfd_map_over_sections (abfd, strings_a_section, (PTR) file);
if (!bfd_close (abfd))
{
bfd_nonfatal (file);
- return false;
+ return FALSE;
}
return got_a_section;
}
-/* Print the strings in FILE. Return true if ok, false if an error occurs. */
+/* Print the strings in FILE. Return TRUE if ok, FALSE if an error occurs. */
-static boolean
+static bfd_boolean
strings_file (file)
char *file;
{
@@ -391,7 +397,7 @@ strings_file (file)
{
fprintf (stderr, "%s: ", program_name);
perror (file);
- return false;
+ return FALSE;
}
print_strings (file, stream, (file_off) 0, 0, 0, (char *) 0);
@@ -400,11 +406,11 @@ strings_file (file)
{
fprintf (stderr, "%s: ", program_name);
perror (file);
- return false;
+ return FALSE;
}
}
- return true;
+ return TRUE;
}
/* Read the next character, return EOF if none available.