Add code to retry certain open()s.
[deliverable/binutils-gdb.git] / gas / listing.c
index 985522866aea52523d13346694653583cb5da4e9..8168ebe6b9812d156db1ef46bbca84db60c42704 100644 (file)
@@ -1,5 +1,6 @@
 /* listing.c - mainting assembly listings
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+   2001
    Free Software Foundation, Inc.
 
 This file is part of GAS, the GNU Assembler.
@@ -119,20 +120,17 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #endif
 
 /* This structure remembers which .s were used.  */
-typedef struct file_info_struct
-{
+typedef struct file_info_struct {
   struct file_info_struct * next;
   char *                    filename;
   long                      pos;
   unsigned int              linenum;
   int                       at_end;
-}
-file_info_type;
+} file_info_type;
 
 /* This structure rememebrs which line from which file goes into which
    frag.  */
-struct list_info_struct
-{
+struct list_info_struct {
   /* Frag which this line of source is nearest to.  */
   fragS *frag;
 
@@ -157,16 +155,15 @@ struct list_info_struct
   /* Pointer to any error message associated with this line.  */
   char *message;
 
-  enum
-    {
-      EDICT_NONE,
-      EDICT_SBTTL,
-      EDICT_TITLE,
-      EDICT_NOLIST,
-      EDICT_LIST,
-      EDICT_NOLIST_NEXT,
-      EDICT_EJECT
-    } edict;
+  enum {
+    EDICT_NONE,
+    EDICT_SBTTL,
+    EDICT_TITLE,
+    EDICT_NOLIST,
+    EDICT_LIST,
+    EDICT_NOLIST_NEXT,
+    EDICT_EJECT
+  } edict;
   char *edict_arg;
 
   /* Nonzero if this line is to be omitted because it contains
@@ -194,7 +191,7 @@ static int                       paper_height = 60;
 extern int                       listing;
 
 /* File to output listings to.  */
-static FILE * list_file;
+static FILE *list_file;
 
 /* This static array is used to keep the text of data to be printed
    before the start of the line.  */
@@ -209,7 +206,7 @@ static char *data_buffer;
 
 /* Prototypes.  */
 static void listing_message PARAMS ((const char *name, const char *message));
-static file_info_type * file_info PARAMS ((const char *file_name));
+static file_info_type *file_info PARAMS ((const char *file_name));
 static void new_frag PARAMS ((void));
 static char *buffer_line PARAMS ((file_info_type *file,
                                  char *line, unsigned int size));
@@ -230,12 +227,12 @@ listing_message (name, message)
      const char *name;
      const char *message;
 {
-  unsigned int l = strlen (name) + strlen (message) + 1;
-  char *n = (char *) xmalloc (l);
-  strcpy (n, name);
-  strcat (n, message);
   if (listing_tail != (list_info_type *) NULL)
     {
+      unsigned int l = strlen (name) + strlen (message) + 1;
+      char *n = (char *) xmalloc (l);
+      strcpy (n, name);
+      strcat (n, message);
       listing_tail->message = n;
     }
 }
@@ -617,6 +614,7 @@ calc_hex (list)
          data_buffer_size += 2;
          octet_in_frag++;
        }
+    if (frag_ptr->fr_type == rs_fill)
       {
        unsigned int var_rep_max = octet_in_frag;
        unsigned int var_rep_idx = octet_in_frag;
@@ -1010,6 +1008,8 @@ listing_listing (name)
          show_listing--;
          break;
        case EDICT_NOLIST_NEXT:
+         if (show_listing == 0)
+           list_line--;
          break;
        case EDICT_EJECT:
          break;
@@ -1032,7 +1032,8 @@ listing_listing (name)
            p = buffer_line (list->file, buffer, width);
        }
 
-      if (list->edict == EDICT_LIST)
+      if (list->edict == EDICT_LIST
+         || (list->edict == EDICT_NOLIST_NEXT && show_listing == 0))
        {
          /* Enable listing for the single line that caused the enable.  */
          list_line++;
@@ -1093,7 +1094,7 @@ listing_listing (name)
            }
        }
 
-      if (list->edict == EDICT_NOLIST_NEXT)
+      if (list->edict == EDICT_NOLIST_NEXT && show_listing == 1)
        --show_listing;
 
       list = list->next;
This page took 0.024495 seconds and 4 git commands to generate.