* config.bfd (arm*-*-symbianelf*): Use OS-specific target vectors.
[external/binutils.git] / gas / output-file.c
index 304e904..4005fbf 100644 (file)
@@ -1,5 +1,5 @@
 /* output-file.c -  Deal with the output file
-   Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2001
+   Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2001, 2003
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -48,7 +48,10 @@ output_file_create (char *name)
 
   else if (!(stdoutput = bfd_openw (name, TARGET_FORMAT)))
     {
-      as_perror (_("FATAL: can't create %s"), name);
+      if (bfd_get_error () == bfd_error_invalid_target)
+       as_perror (_("Selected target format '%s' unknown"), TARGET_FORMAT);
+      else
+       as_perror (_("FATAL: can't create %s"), name);
       exit (EXIT_FAILURE);
     }
 
@@ -84,10 +87,9 @@ output_file_close (char *filename)
 
 #ifndef BFD_ASSEMBLER
 void
-output_file_append (where, length, filename)
-     char *where ATTRIBUTE_UNUSED;
-     long length ATTRIBUTE_UNUSED;
-     char *filename ATTRIBUTE_UNUSED;
+output_file_append (char *where ATTRIBUTE_UNUSED,
+                   long length ATTRIBUTE_UNUSED,
+                   char *filename ATTRIBUTE_UNUSED)
 {
   abort ();
 }
@@ -98,8 +100,7 @@ output_file_append (where, length, filename)
 static FILE *stdoutput;
 
 void
-output_file_create (name)
-     char *name;
+output_file_create (char *name)
 {
   if (name[0] == '-' && name[1] == '\0')
     {
@@ -110,17 +111,22 @@ output_file_create (name)
   stdoutput = fopen (name, FOPEN_WB);
   if (stdoutput == NULL)
     {
+#ifdef BFD_ASSEMBLER
+      bfd_set_error (bfd_error_system_call);
+#endif
       as_perror (_("FATAL: can't create %s"), name);
       exit (EXIT_FAILURE);
     }
 }
 
 void
-output_file_close (filename)
-     char *filename;
+output_file_close (char *filename)
 {
   if (EOF == fclose (stdoutput))
     {
+#ifdef BFD_ASSEMBLER
+      bfd_set_error (bfd_error_system_call);
+#endif
       as_perror (_("FATAL: can't close %s"), filename);
       exit (EXIT_FAILURE);
     }
@@ -130,18 +136,17 @@ output_file_close (filename)
 }
 
 void
-output_file_append (where, length, filename)
-     char * where;
-     long   length;
-     char * filename;
+output_file_append (char * where, long length, char * filename)
 {
   for (; length; length--, where++)
     {
       (void) putc (*where, stdoutput);
 
       if (ferror (stdoutput))
-       /* if ( EOF == (putc( *where, stdoutput )) ) */
        {
+#ifdef BFD_ASSEMBLER
+         bfd_set_error (bfd_error_system_call);
+#endif
          as_perror (_("Failed to emit an object byte"), filename);
          as_fatal (_("can't continue"));
        }