Update copyright date.
[deliverable/binutils-gdb.git] / binutils / strings.c
index ab845b04d42bc9a3313a55ac91c225bc4df39b00..5d3aa6d4fa7f8dab802360c8aadd3619ea45413c 100644 (file)
@@ -1,5 +1,5 @@
 /* strings -- print the strings of printable characters in files
-   Copyright (C) 1993, 94, 95, 96, 97, 98, 99, 2000
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
    Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
 #include "bucomm.h"
 #include "libiberty.h"
 
-#ifdef isascii
-#define isgraphic(c) (isascii (c) && isprint (c))
+/* 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 isgraphic(c) (isprint (c))
+#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
+
+/* Not all printable characters have ASCII codes (depending upon the
+   LOCALE set) but on some older systems it is not safe to test isprint
+   without first testing isascii...  */
+#if defined isascii && !defined HAVE_LOCALE_H
+#define isgraphic(c) (isascii (c) && (isprint (c) || (c) == '\t'))
+#else
+#define isgraphic(c) (isprint (c) || (c) == '\t')
 #endif
 
 #ifndef errno
@@ -124,7 +144,7 @@ main (argc, argv)
   boolean files_given = false;
 
 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
-  setlocale (LC_MESSAGES, "");
+  setlocale (LC_ALL, "");
 #endif
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
@@ -218,6 +238,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;
     }
This page took 0.024147 seconds and 4 git commands to generate.