Eli Zaretskii's DOSish file name patches.
[deliverable/binutils-gdb.git] / binutils / strings.c
index fb139fab9bec853157090632aa766d9125507dad..54f29e43abb8fd4ac59520e31c5845c384a69d12 100644 (file)
@@ -1,5 +1,6 @@
 /* strings -- print the strings of printable characters in files
-   Copyright (C) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1993, 94, 95, 96, 97, 98, 99, 2000
+   Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #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
@@ -156,9 +174,7 @@ main (argc, argv)
          string_min = integer_arg (optarg);
          if (string_min < 1)
            {
-             fprintf (stderr, _("%s: invalid number %s\n"),
-                      program_name, optarg);
-             exit (1);
+             fatal (_("invalid number %s"), optarg);
            }
          break;
 
@@ -219,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;
     }
@@ -491,8 +510,7 @@ integer_arg (s)
 
   if (*p)
     {
-      fprintf (stderr, _("%s: invalid integer argument %s\n"), program_name, s);
-      exit (1);
+      fatal (_("invalid integer argument %s"), s);
     }
   return value;
 }
@@ -509,6 +527,6 @@ Usage: %s [-afov] [-n min-len] [-min-len] [-t {o,x,d}] [-]\n\
           program_name);
   list_supported_targets (program_name, stream);
   if (status == 0)
-    fprintf (stream, _("Report bugs to bug-gnu-utils@gnu.org\n"));
+    fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
   exit (status);
 }
This page took 0.023706 seconds and 4 git commands to generate.