]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix command line option handling.
authorBruno Haible <bruno@clisp.org>
Fri, 23 Mar 2001 20:49:23 +0000 (20:49 +0000)
committerBruno Haible <bruno@clisp.org>
Fri, 23 Mar 2001 20:49:23 +0000 (20:49 +0000)
src/ChangeLog
src/msgcomm.c

index 6ba24674d7e03575e2022e4051f04cfe97a335b0..bd02633e9a40b8db8577d23f4c59d3ac57e05a49 100644 (file)
@@ -1,3 +1,10 @@
+2001-03-23  Bruno Haible  <haible@clisp.cons.org>
+
+       * msgcomm.c (main): Don't give an error message if there are "too few"
+       messages in the input files. Do sanity checking before reading the
+       input files. Make --add-location the default, even if --omit-header
+       is specified.
+
 2001-03-22  Bruno Haible  <haible@clisp.cons.org>
 
        * xgettext.c (construct_header): Replace ENCODING with 8-bit.
index d31d804401c7b3e37838b087413c97d899462d95..28b1aed5c29fafa4c90a4f58a200caeb3fe7d5c1 100644 (file)
@@ -160,7 +160,6 @@ main (argc, argv)
   textdomain (PACKAGE);
 
   /* Set initial value of variables.  */
-  line_comment = -1;
   default_domain = MESSAGE_DOMAIN_DEFAULT;
 
   while ((optchar = getopt_long (argc, argv,
@@ -263,10 +262,7 @@ main (argc, argv)
        /* NOTREACHED */
       }
 
-  /* Normalize selected options.  */
-  if (omit_header != 0 && line_comment < 0)
-    line_comment = 0;
-
+  /* Verify selected options.  */
   if (!line_comment && sort_by_file)
     error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
           "--no-location", "--sort-by-file");
@@ -328,24 +324,24 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
       usage (EXIT_FAILURE);
     }
 
-  /* Allocate a message list to remember all the messages.  */
-  mlp = message_list_alloc ();
-
-  /* Process all input files.  */
-  for (cnt = 0; cnt < file_list->nitems; ++cnt)
-    read_po_file (file_list->item[cnt], mlp);
-  string_list_free (file_list);
-
   /* Default the message selection criteria, and check them for sanity.  */
   if (more_than < 0)
     more_than = (less_than < 0 ? 1 : 0);
   if (less_than < 0)
     less_than = INT_MAX;
-  if (more_than >= less_than || less_than < 2 || more_than >= mlp->nitems)
+  if (more_than >= less_than || less_than < 2)
     error (EXIT_FAILURE, 0,
            _("impossible selection criteria specified (%d < n < %d)"),
            more_than, less_than);
 
+  /* Allocate a message list to remember all the messages.  */
+  mlp = message_list_alloc ();
+
+  /* Process all input files.  */
+  for (cnt = 0; cnt < file_list->nitems; ++cnt)
+    read_po_file (file_list->item[cnt], mlp);
+  string_list_free (file_list);
+
   /* Remove messages which do not fit the criteria.  */
   j = 0;
   while (j < mlp->nitems)