If sysdep.h includes a header file, don't include it again:
[deliverable/binutils-gdb.git] / bfd / evax-misc.c
index 4e2862d0e288886fc80d7a9cabc05b9e3a7642ee..4dc74ed88257618ec49e03b01500a753b9171f5b 100644 (file)
@@ -1,5 +1,5 @@
 /* evax-misc.c -- Miscellaneous functions for ALPHA EVAX (openVMS/Alpha) files.
-   Copyright 1996, 1997 Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
 
    Written by Klaus K"ampf (kkaempf@progis.de)
    of proGIS Softwareentwicklung, Aachen, Germany
@@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #if __STDC__
 #include <stdarg.h>
 #endif
-#include <stdio.h>
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -898,12 +897,12 @@ int len;
   len = strlen (value);
   if (len == 0)
     {
-      (*_bfd_error_handler) ("_bfd_evax_output_counted called with zero bytes");
+      (*_bfd_error_handler) (_("_bfd_evax_output_counted called with zero bytes"));
       return;
     }
   if (len > 255)
     {
-      (*_bfd_error_handler) ("_bfd_evax_output_counted called with too many bytes");
+      (*_bfd_error_handler) (_("_bfd_evax_output_counted called with too many bytes"));
       return;
     }
   _bfd_evax_output_byte (abfd, len & 0xff);
@@ -972,12 +971,13 @@ hash_string (ptr)
   return hash;
 }
 
-/* Generate a length-hashed VMS symbol name (limited to 64 chars).  */
+/* Generate a length-hashed VMS symbol name (limited to maxlen chars).  */
 
 char *
-_bfd_evax_length_hash_symbol (abfd, in)
+_bfd_evax_length_hash_symbol (abfd, in, maxlen)
      bfd *abfd;
      const char *in;
+     int maxlen;
 {
   long int init;
   long int result;
@@ -986,48 +986,58 @@ _bfd_evax_length_hash_symbol (abfd, in)
   char *new_name;
   const char *old_name;
   int i;
-  static char outbuf[65];
+  static char outbuf[EOBJ_S_C_SYMSIZ+1];
   char *out = outbuf;
 
 #if EVAX_DEBUG
   evax_debug(4, "_bfd_evax_length_hash_symbol \"%s\"\n", in);
 #endif
 
+  if (maxlen > EOBJ_S_C_SYMSIZ)
+    maxlen = EOBJ_S_C_SYMSIZ;
+
   new_name = out;              /* save this for later.  */
 
   /* We may need to truncate the symbol, save the hash for later.  */
 
   in_len = strlen (in);
 
-  result = (in_len > 64) ? hash_string (in) : 0;
+  result = (in_len > maxlen) ? hash_string (in) : 0;
 
   old_name = in;
 
   /* Do the length checking.  */
 
-  if (in_len <= 64)
-    i = in_len;
+  if (in_len <= maxlen)
+    {
+      i = in_len;
+    }
+  else
+    {
+      if (PRIV(flag_hash_long_names))
+       i = maxlen-9;
       else
-    i = 55;
+       i = maxlen;
+    }
 
   strncpy (out, in, i);
   in += i;
   out += i;
 
-  if ((in_len > 64)
+  if ((in_len > maxlen)
       && PRIV(flag_hash_long_names))
     sprintf (out, "_%08x", result);
   else
-  *out = 0;
+    *out = 0;
 
 #if EVAX_DEBUG
   evax_debug(4, "--> [%d]\"%s\"\n", strlen (outbuf), outbuf);
 #endif
 
-  if (in_len > 64
+  if (in_len > maxlen
        && PRIV(flag_hash_long_names)
        && PRIV(flag_show_after_trunc))
-    printf ("Symbol %s replaced by %s\n", old_name, new_name);
+    printf (_("Symbol %s replaced by %s\n"), old_name, new_name);
 
   return outbuf;
 }
This page took 0.025557 seconds and 4 git commands to generate.