Add prototypes for static functions.
[binutils-gdb.git] / bfd / evax-emh.c
index b59023b5a48a5843d8df6aa7117cadf53bcf5890..79a63d2adbb35edb3e14b334d9e2fb3279c27b6d 100644 (file)
@@ -1,11 +1,11 @@
-/* evax-emh.c -- BFD back-end for ALPHA EVAX (openVMS/AXP) files.
-   Copyright 1996 Free Software Foundation, Inc.
+/* evax-emh.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files.
+   Copyright 1996, 1997, 1998 Free Software Foundation, Inc.
 
    EMH record handling functions
    and
    EEOM record handling functions
 
-   Written by Klaus Kรคmpf (kkaempf@progis.de)
+   Written by Klaus K"ampf (kkaempf@progis.de)
    of proGIS Softwareentwicklung, Aachen, Germany
 
 This program is free software; you can redistribute it and/or modify
@@ -22,7 +22,7 @@ You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-#include <stdio.h>
+#include <ctype.h>
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -136,7 +136,6 @@ get_vms_time_string ()
 {
   static unsigned char tbuf[18];
 #ifndef VMS
-#include <sys/types.h>
 #include <time.h>
 
   char *pnt;
@@ -158,7 +157,7 @@ get_vms_time_string ()
   } Descriptor;
   Descriptor.Size = 17;
   Descriptor.Ptr = tbuf;
-  sys$asctim (0, &Descriptor, 0, 0);
+  SYS$ASCTIM (0, &Descriptor, 0, 0);
 #endif /* not VMS */
 
 #if EVAX_DEBUG
@@ -196,7 +195,41 @@ _bfd_evax_write_emh (abfd)
   _bfd_evax_output_long (abfd, MAX_OUTREC_SIZE);
 
   if (bfd_get_filename (abfd) != 0)
-    _bfd_evax_output_counted (abfd, bfd_get_filename (abfd));
+    {
+      /* strip path and suffix information */
+
+      char *fname, *fout, *fptr;
+
+      fptr = bfd_get_filename (abfd);
+      fname = (char *) alloca (strlen (fptr) + 1);
+      strcpy (fname, fptr);
+      fout = strrchr (fname, ']');
+      if (fout == 0)
+       fout = strchr (fname, ':');
+      if (fout != 0)
+       fout++;
+      else
+       fout = fname;
+
+      /* strip .obj suffix  */
+
+      fptr = strrchr (fname, '.');
+      if ((fptr != 0)
+         && (strcasecmp (fptr, ".OBJ") == 0))
+       *fptr = 0;
+
+      fptr = fout;
+      while (*fptr != 0)
+       {
+         if (islower (*fptr))
+           *fptr = toupper (*fptr);
+         fptr++;
+         if ((*fptr == ';')
+            || ((fptr - fout) > 31))
+           *fptr = 0;
+       }
+      _bfd_evax_output_counted (abfd, fout);
+    }
   else
     _bfd_evax_output_counted (abfd, "NONAME");
 
@@ -227,8 +260,6 @@ _bfd_evax_write_emh (abfd)
            {
              PRIV(flag_hash_long_names) = symbol->name[6] - '0';
              PRIV(flag_show_after_trunc) = symbol->name[7] - '0';
-             PRIV(flag_no_hash_mixed_case) = symbol->name[8] - '0';
-             PRIV(vms_name_mapping) = symbol->name[9] - '0';
 
              if (had_file)
                break;
@@ -236,7 +267,7 @@ _bfd_evax_write_emh (abfd)
              continue;
            }
 
-         _bfd_evax_output_dump (abfd, (char *)symbol->name, strlen (symbol->name));
+         _bfd_evax_output_dump (abfd, (unsigned char *)symbol->name, strlen (symbol->name));
          if (had_case)
            break;
          had_file = 1;
@@ -244,7 +275,7 @@ _bfd_evax_write_emh (abfd)
     }
 
   if (symnum == abfd->symcount)
-    _bfd_evax_output_dump (abfd, "noname", 6);
+    _bfd_evax_output_dump (abfd, (unsigned char *)"noname", 6);
 
   _bfd_evax_output_flush (abfd);
 
@@ -286,7 +317,7 @@ _bfd_evax_slurp_eeom (abfd)
   PRIV(eeom_data).eeom_b_comcod = *(evax_rec + 8);
   if (PRIV(eeom_data).eeom_b_comcod > 1)
     {
-      (*_bfd_error_handler) ("Object module NOT error-free !\n");
+      (*_bfd_error_handler) (_("Object module NOT error-free !\n"));
       bfd_set_error (bfd_error_bad_value);
       return -1;
     }