about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-22 23:15:39 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-22 23:15:39 +0000
commit819c56e76de80b99e1c04516597518f278820048 (patch)
tree866cbdeae6cd0ef56c9d3463a806ab6b5b97c863
parentd5ca9483e82fb574fb3bff9858321c2cb2df1be7 (diff)
downloadglibc-819c56e76de80b99e1c04516597518f278820048.tar.gz
glibc-819c56e76de80b99e1c04516597518f278820048.tar.xz
glibc-819c56e76de80b99e1c04516597518f278820048.zip
Update.
	* catgets/gencat.c (read_input_file): Collision between
	auto-assigned numbers and user-defined nubmers is not fatal.
	Handle it.
	Patch by Michael M. Lampkin <michael.lampkin@ieee.org>.

	* catgets/gencat.c (main): Return 1 if messages have been printed.
-rw-r--r--ChangeLog7
-rw-r--r--catgets/gencat.c41
2 files changed, 42 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 9390307261..2acce14141 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,13 @@
 
 2003-02-22  Ulrich Drepper  <drepper@redhat.com>
 
+	* catgets/gencat.c (read_input_file): Collision between
+	auto-assigned numbers and user-defined nubmers is not fatal.
+	Handle it.
+	Patch by Michael M. Lampkin <michael.lampkin@ieee.org>.
+
+	* catgets/gencat.c (main): Return 1 if messages have been printed.
+
 	* iconv/iconv_prog.c (main): Unify messages.
 
 	* stdlib/strtod.c (INTERNAL): Remove bogus clearing of second word
diff --git a/catgets/gencat.c b/catgets/gencat.c
index ff535dec1d..175f1ffd09 100644
--- a/catgets/gencat.c
+++ b/catgets/gencat.c
@@ -197,7 +197,7 @@ main (int argc, char *argv[])
   if (result != NULL)
     write_out (result, output_name, header_name);
 
-  return EXIT_SUCCESS;
+  return error_message_count != 0;
 }
 
 
@@ -613,11 +613,40 @@ this is the first definition"));
 		{
 		  /* Oh, oh.  There is already a message with this
 		     number in the message set.  */
-		  error_at_line (0, 0, fname, start_line,
-				 gettext ("duplicated message number"));
-		  error_at_line (0, 0, runp->fname, runp->line,
-				 gettext ("this is the first definition"));
-		  message_number = 0;
+		  if (runp->symbol == NULL)
+		    {
+		      /* The existing message had its number specified
+			 by the user.  Fatal collision type uh, oh.  */
+		      error_at_line (0, 0, fname, start_line,
+				     gettext ("duplicated message number"));
+		      error_at_line (0, 0, runp->fname, runp->line,
+				     gettext ("this is the first definition"));
+		      message_number = 0;
+		    }
+		  else
+		    {
+		      /* Collision was with number auto-assigned to a
+			 symbolic.  Change existing symbolic number
+			 and move to end the list (if not already there).  */
+		      runp->number = ++current->current_set->last_message;
+
+		      if (runp->next != NULL)
+			{
+			  struct message_list *endp;
+
+			  if (lastp == NULL)
+			    current->current_set->messages=runp->next;
+			  else
+			    lastp->next=runp->next;
+
+			  endp = runp->next;
+			  while (endp->next != NULL)
+			    endp = endp->next;
+
+			  endp->next = runp;
+			  runp->next = NULL;
+			}
+		    }
 		}
 	      ident = NULL;	/* We don't have a symbol.  */