chew

Alan Modra amodra@bigpond.net.au
Thu Jan 31 00:58:00 GMT 2002


The following triggered a bug in doc/chew.c
2002-01-30  Nick Clifton  <nickc@cambridge.redhat.com>
	* archures.c: Tidy up formatting of embedded comments.

Fixed like so

	* chew.c (courierize): Don't modify @command params.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: bfd/doc/chew.c
===================================================================
RCS file: /cvs/src/src/bfd/doc/chew.c,v
retrieving revision 1.7
diff -u -p -r1.7 chew.c
--- chew.c	2001/03/08 21:04:02	1.7
+++ chew.c	2002/01/31 06:12:29
@@ -686,37 +686,47 @@ WORD (courierize)
 
 	      while (at (tos, idx) && at (tos, idx) != '\n')
 		{
-		  if (at (tos, idx) == '{' && at (tos, idx + 1) == '*')
+		  if (command > 1)
 		    {
+		      /* We are inside {} parameters of some command;
+			 Just pass through until matching brace.  */
+		      if (at (tos, idx) == '{')
+			++command;
+		      else if (at (tos, idx) == '}')
+			--command;
+		    }
+		  else if (command != 0)
+		    {
+		      if (at (tos, idx) == '{')
+			++command;
+		      else if (!islower ((unsigned char) at (tos, idx)))
+			--command;
+		    }
+		  else if (at (tos, idx) == '@'
+			   && islower ((unsigned char) at (tos, idx + 1)))
+		    {
+		      ++command;
+		    }
+		  else if (at (tos, idx) == '{' && at (tos, idx + 1) == '*')
+		    {
 		      cattext (&out, "/*");
 		      idx += 2;
+		      continue;
 		    }
 		  else if (at (tos, idx) == '*' && at (tos, idx + 1) == '}')
 		    {
 		      cattext (&out, "*/");
 		      idx += 2;
-		    }
-		  else if (at (tos, idx) == '{' && !command)
-		    {
-		      cattext (&out, "@{");
-		      idx++;
-		    }
-		  else if (at (tos, idx) == '}' && !command)
-		    {
-		      cattext (&out, "@}");
-		      idx++;
+		      continue;
 		    }
-		  else
+		  else if (at (tos, idx) == '{'
+			   || at (tos, idx) == '}')
 		    {
-		      if (at (tos, idx) == '@')
-			command = 1;
-		      else if (isspace ((unsigned char) at (tos, idx))
-			       || at (tos, idx) == '}')
-			command = 0;
-		      catchar (&out, at (tos, idx));
-		      idx++;
+		      catchar (&out, '@');
 		    }
 
+		  catchar (&out, at (tos, idx));
+		  idx++;
 		}
 	      catchar (&out, '\n');
 	    }



More information about the Binutils mailing list