aboutsummaryrefslogtreecommitdiff
path: root/binutils/strings.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-05-26 13:11:57 +0000
committerAlan Modra <amodra@gmail.com>2000-05-26 13:11:57 +0000
commit5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e (patch)
tree43c01869523de4ad682493e6674e5e8a9fed1804 /binutils/strings.c
parent010c70e10fb422ae6151a8808215a122f461fce8 (diff)
downloadgdb-5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e.zip
gdb-5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e.tar.gz
gdb-5af11cab92a8d4ed9b0cd7a46f05cf02a8ba901e.tar.bz2
Eli Zaretskii's DOSish file name patches.
Diffstat (limited to 'binutils/strings.c')
-rw-r--r--binutils/strings.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/binutils/strings.c b/binutils/strings.c
index ab845b0..54f29e4 100644
--- a/binutils/strings.c
+++ b/binutils/strings.c
@@ -59,6 +59,23 @@
#include "bucomm.h"
#include "libiberty.h"
+/* Some platforms need to put stdin into binary mode, to read
+ binary files. */
+#ifdef HAVE_SETMODE
+#ifndef O_BINARY
+#ifdef _O_BINARY
+#define O_BINARY _O_BINARY
+#define setmode _setmode
+#else
+#define O_BINARY 0
+#endif
+#endif
+#if O_BINARY
+#include <io.h>
+#define SET_BINARY(f) do { if (!isatty(f)) setmode(f,O_BINARY); } while (0)
+#endif
+#endif
+
#ifdef isascii
#define isgraphic(c) (isascii (c) && isprint (c))
#else
@@ -218,6 +235,9 @@ main (argc, argv)
if (optind >= argc)
{
datasection_only = false;
+#ifdef SET_BINARY
+ SET_BINARY (fileno (stdin));
+#endif
print_strings ("{standard input}", stdin, 0, 0, 0, (char *) NULL);
files_given = true;
}