* valops.c (value_one): Reimplement broken decimal-float case.
[deliverable/binutils-gdb.git] / gas / listing.c
index 6932e8679b48233e3c5b987e074aa5b3a86eaeba..e307be21c9a3b77c9533d1af95eedbb91156fa68 100644 (file)
@@ -338,13 +338,18 @@ listing_newline (char *ps)
          char *copy;
          int len;
          int seen_quote = 0;
+         int seen_slash = 0;
 
          for (copy = input_line_pointer - 1;
               *copy && (seen_quote
-                        || (! is_end_of_line [(unsigned char) *copy]));
+                        || is_end_of_line [(unsigned char) *copy] != 1);
               copy++)
-           if (*copy == '"' && copy[-1] != '\\')
-             seen_quote = ! seen_quote;
+           {
+             if (*copy == '\\')
+               seen_slash = ! seen_slash;
+             else if (*copy == '"' && seen_slash)
+               seen_quote = ! seen_quote;
+           }
 
          len = (copy - input_line_pointer) + 2;
 
@@ -471,8 +476,10 @@ buffer_line (file_info_type *file, char *line, unsigned int size)
          fclose (last_open_file);
        }
 
+      /* Open the file in the binary mode so that ftell above can
+        return a reliable value that we can feed to fseek below.  */
       last_open_file_info = file;
-      last_open_file = fopen (file->filename, FOPEN_RT);
+      last_open_file = fopen (file->filename, FOPEN_RB);
       if (last_open_file == NULL)
        {
          file->at_end = 1;
@@ -489,7 +496,7 @@ buffer_line (file_info_type *file, char *line, unsigned int size)
   /* Leave room for null.  */
   size -= 1;
 
-  while (c != EOF && c != '\n')
+  while (c != EOF && c != '\n' && c != '\r')
     {
       if (count < size)
        *p++ = c;
@@ -498,6 +505,17 @@ buffer_line (file_info_type *file, char *line, unsigned int size)
       c = fgetc (last_open_file);
 
     }
+
+  /* If '\r' is followed by '\n', swallow that.  Likewise, if '\n'
+     is followed by '\r', swallow that as well.  */
+  if (c == '\r' || c == '\n')
+    {
+      int next = fgetc (last_open_file);
+      if ((c == '\r' && next != '\n')
+         || (c == '\n' && next != '\r'))
+       ungetc (next, last_open_file);
+    }
+
   if (c == EOF)
     {
       file->at_end = 1;
@@ -1100,7 +1118,7 @@ print_options (char ** argv)
   int pos = strlen (field_name);
   char **p;
 
-  fprintf (list_file, field_name);
+  fputs (field_name, list_file);
   for (p = &argv[1]; *p != NULL; p++)
     if (**p == '-')
       {
This page took 0.024249 seconds and 4 git commands to generate.