summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2000-06-20 06:55:50 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2000-06-20 06:55:50 +0000
commit84c87cba1aa23a1184bee7f4ddb2d7a44e3727b4 (patch)
tree34209419c4b2b1ce1cd010b5a0b98e340d0b754d
parent76efa1c2d860574f58d2080fc65515c2ea169770 (diff)
Notes
-rw-r--r--contrib/binutils/binutils/strings.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/contrib/binutils/binutils/strings.c b/contrib/binutils/binutils/strings.c
index d3247ea442d2..8bc618aa2e50 100644
--- a/contrib/binutils/binutils/strings.c
+++ b/contrib/binutils/binutils/strings.c
@@ -61,10 +61,27 @@
#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) || isblank (c)))
+#define isgraphic(c) (isascii (c) && (isprint (c) || (c) == '\t'))
#else
-#define isgraphic(c) (isprint (c) || isblank (c))
+#define isgraphic(c) (isprint (c) || (c) == '\t')
#endif
#ifndef errno
@@ -220,6 +237,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;
}