* configure.in: Stop checking for fopen64 and stat64.
* strings.c (file_off, file_open, statbuf, file_stat): Remove.
(strings_file): Change file_off to file_ptr, file_open to fopen,
statbuf to struct stat and file_stat to stat.
(get_char): Change parameter type file_off * to file_ptr *.
(print_strings): Change parameter and variable `start' type file_off to
file_ptr.
* configure: Regenerate.
* config.in: Regenerate.
+2009-11-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * configure.in: Stop checking for fopen64 and stat64.
+ * strings.c (file_off, file_open, statbuf, file_stat): Remove.
+ (strings_file): Change file_off to file_ptr, file_open to fopen,
+ statbuf to struct stat and file_stat to stat.
+ (get_char): Change parameter type file_off * to file_ptr *.
+ (print_strings): Change parameter and variable `start' type file_off to
+ file_ptr.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+
2009-11-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* configure.in: Call ACX_LARGEFILE. Stop calling AC_PLUGINS,
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
-/* Is fopen64 available? */
-#undef HAVE_FOPEN64
-
/* Define to 1 if you have the `getc_unlocked' function. */
#undef HAVE_GETC_UNLOCKED
/* Define to 1 if you have the `setmode' function. */
#undef HAVE_SETMODE
-/* Is stat64 available? */
-#undef HAVE_STAT64
-
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
-/* Enable LFS */
-#undef _LARGEFILE64_SOURCE
-
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
fi
-# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
-# needs to be defined for it
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fopen64" >&5
-$as_echo_n "checking for fopen64... " >&6; }
-if test "${bu_cv_have_fopen64+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen64 ("/tmp/foo","r");
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- bu_cv_have_fopen64=yes
-else
- saved_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen64 ("/tmp/foo","r");
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE"
-else
- bu_cv_have_fopen64=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- CPPFLAGS=$saved_CPPFLAGS
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bu_cv_have_fopen64" >&5
-$as_echo "$bu_cv_have_fopen64" >&6; }
-if test "$bu_cv_have_fopen64" != no; then
-
-$as_echo "#define HAVE_FOPEN64 1" >>confdefs.h
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stat64" >&5
-$as_echo_n "checking for stat64... " >&6; }
-if test "${bu_cv_have_stat64+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sys/stat.h>
-int
-main ()
-{
-struct stat64 st; stat64 ("/tmp/foo", &st);
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- bu_cv_have_stat64=yes
-else
- saved_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sys/stat.h>
-int
-main ()
-{
-struct stat64 st; stat64 ("/tmp/foo", &st);
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE"
-else
- bu_cv_have_stat64=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- CPPFLAGS=$saved_CPPFLAGS
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bu_cv_have_stat64" >&5
-$as_echo "$bu_cv_have_stat64" >&6; }
-if test "$bu_cv_have_stat64" != no; then
-
-$as_echo "#define HAVE_STAT64 1" >>confdefs.h
-
-fi
-if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
- || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
-
-$as_echo "#define _LARGEFILE64_SOURCE 1" >>confdefs.h
-
- CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
-fi
-
# Some systems have frexp only in -lm, not in -lc.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing frexp" >&5
$as_echo_n "checking for library containing frexp... " >&6; }
AC_DEFINE([HAVE_MKDTEMP], 1,
[Define to 1 if you have the `mkdtemp' function.]))
-# Check whether fopen64 is available and whether _LARGEFILE64_SOURCE
-# needs to be defined for it
-AC_MSG_CHECKING([for fopen64])
-AC_CACHE_VAL(bu_cv_have_fopen64,
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");])],
-bu_cv_have_fopen64=yes,
-[saved_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [FILE *f = fopen64 ("/tmp/foo","r");])],
- bu_cv_have_fopen64="need -D_LARGEFILE64_SOURCE",
- bu_cv_have_fopen64=no)
- CPPFLAGS=$saved_CPPFLAGS])])
-AC_MSG_RESULT($bu_cv_have_fopen64)
-if test "$bu_cv_have_fopen64" != no; then
- AC_DEFINE([HAVE_FOPEN64], 1,
- [Is fopen64 available?])
-fi
-AC_MSG_CHECKING([for stat64])
-AC_CACHE_VAL(bu_cv_have_stat64,
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);])],
-bu_cv_have_stat64=yes,
-[saved_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/stat.h>], [struct stat64 st; stat64 ("/tmp/foo", &st);])],
- bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE",
- bu_cv_have_stat64=no)
- CPPFLAGS=$saved_CPPFLAGS])])
-AC_MSG_RESULT($bu_cv_have_stat64)
-if test "$bu_cv_have_stat64" != no; then
- AC_DEFINE([HAVE_STAT64], 1,
- [Is stat64 available?])
-fi
-if test "$bu_cv_have_fopen64" = "need -D_LARGEFILE64_SOURCE" \
- || test "$bu_cv_have_stat64" = "need -D_LARGEFILE64_SOURCE"; then
- AC_DEFINE([_LARGEFILE64_SOURCE], 1,
- [Enable LFS])
- CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE"
-fi
-
# Some systems have frexp only in -lm, not in -lc.
AC_SEARCH_LIBS(frexp, m)
/* The BFD section flags that identify an initialized data section. */
#define DATA_FLAGS (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS)
-#ifdef HAVE_FOPEN64
-typedef off64_t file_off;
-#define file_open(s,m) fopen64(s, m)
-#else
-typedef off_t file_off;
-#define file_open(s,m) fopen(s, m)
-#endif
-#ifdef HAVE_STAT64
-typedef struct stat64 statbuf;
-#define file_stat(f,s) stat64(f, s)
-#else
-typedef struct stat statbuf;
-#define file_stat(f,s) stat(f, s)
-#endif
-
/* Radix for printing addresses (must be 8, 10 or 16). */
static int address_radix;
static void strings_a_section (bfd *, asection *, void *);
static bfd_boolean strings_object_file (const char *);
static bfd_boolean strings_file (char *file);
-static void print_strings (const char *, FILE *, file_off, int, int, char *);
+static void print_strings (const char *, FILE *, file_ptr, int, int, char *);
static void usage (FILE *, int);
-static long get_char (FILE *, file_off *, int *, char **);
+static long get_char (FILE *, file_ptr *, int *, char **);
\f
int main (int, char **);
static bfd_boolean
strings_file (char *file)
{
- statbuf st;
+ struct stat st;
+
+ /* get_file_size does not support non-S_ISREG files. */
- if (file_stat (file, &st) < 0)
+ if (stat (file, &st) < 0)
{
if (errno == ENOENT)
non_fatal (_("'%s': No such file"), file);
{
FILE *stream;
- stream = file_open (file, FOPEN_RB);
+ stream = fopen (file, FOPEN_RB);
if (stream == NULL)
{
fprintf (stderr, "%s: ", program_name);
return FALSE;
}
- print_strings (file, stream, (file_off) 0, 0, 0, (char *) 0);
+ print_strings (file, stream, (file_ptr) 0, 0, 0, (char *) 0);
if (fclose (stream) == EOF)
{
MAGICCOUNT is how many characters are in it. */
static long
-get_char (FILE *stream, file_off *address, int *magiccount, char **magic)
+get_char (FILE *stream, file_ptr *address, int *magiccount, char **magic)
{
int c, i;
long r = EOF;
Those characters come at address ADDRESS and the data in STREAM follow. */
static void
-print_strings (const char *filename, FILE *stream, file_off address,
+print_strings (const char *filename, FILE *stream, file_ptr address,
int stop_point, int magiccount, char *magic)
{
char *buf = (char *) xmalloc (sizeof (char) * (string_min + 1));
while (1)
{
- file_off start;
+ file_ptr start;
int i;
long c;