* doc/Makefile.am (config.texi): Emit a @set UPDATED command to
[deliverable/binutils-gdb.git] / binutils / strings.c
index 8a27fa800e4b1f3b3d1e89e2f86fb5baed1f8fb3..2fcdb95e2086c107ef78c54bcf0585a46aac2896 100644 (file)
@@ -67,6 +67,7 @@
 #include "bucomm.h"
 #include "libiberty.h"
 #include "safe-ctype.h"
+#include <sys/stat.h>
 
 /* Some platforms need to put stdin into binary mode, to read
     binary files.  */
@@ -104,6 +105,13 @@ typedef off64_t file_off;
 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;
@@ -370,8 +378,17 @@ strings_object_file (const char *file)
 static bfd_boolean
 strings_file (char *file)
 {
-  if (get_file_size (file) < 1)
-    return FALSE;
+  statbuf st;
+
+  if (file_stat (file, &st) < 0)
+    {
+      if (errno == ENOENT)
+       non_fatal (_("'%s': No such file"), file);
+      else
+       non_fatal (_("Warning: could not locate '%s'.  reason: %s"),
+                  file, strerror (errno));
+      return FALSE;
+    }
 
   /* If we weren't told to scan the whole file,
      try to open it as an object file and only look at
@@ -638,7 +655,7 @@ usage (FILE *stream, int status)
   -f --print-file-name      Print the name of the file before each string\n\
   -n --bytes=[number]       Locate & print any NUL-terminated sequence of at\n\
   -<number>                 least [number] characters (default 4).\n\
-  -t --radix={o,x,d}        Print the location of the string in base 8, 10 or 16\n\
+  -t --radix={o,d,x}        Print the location of the string in base 8, 10 or 16\n\
   -o                        An alias for --radix=o\n\
   -T --target=<BFDNAME>     Specify the binary file format\n\
   -e --encoding={s,S,b,l,B,L} Select character size and endianness:\n\
This page took 0.024643 seconds and 4 git commands to generate.