]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Reorganize the option checking.
authorBruno Haible <bruno@clisp.org>
Sun, 23 Sep 2001 14:42:25 +0000 (14:42 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 23 Sep 2001 14:42:25 +0000 (14:42 +0000)
src/ChangeLog
src/msgcat.c
src/msgcomm.c
src/msgconv.c
src/msgen.c
src/msgexec.c
src/msggrep.c
src/msgmerge.c
src/msguniq.c
src/xgettext.c

index 1eced767c9b3d3120f21a9ef5522cd9feb6bcc5c..6706d791099ecc50e5502584ea392148501c5800 100644 (file)
@@ -1,3 +1,17 @@
+2001-09-08  Bruno Haible  <haible@clisp.cons.org>
+
+       * msgcat.c (main): Move the option checking after the handling of
+       --version and --help, but before opening of any file.
+       * msgcomm.c (main): Move the option checking after the handling of
+       --version and --help.
+       * msguniq.c (main): Likewise.
+       * xgettext.c (main): Likewise.
+       * msgconv.c (main): Additional option checking for --sort-by-file.
+       * msgen.c (main): Likewise.
+       * msgexec.c (main): Likewise.
+       * msggrep.c (main): Likewise.
+       * msgmerge.c (main): Likewise.
+
 2001-09-08  Bruno Haible  <haible@clisp.cons.org>
 
        * dir-list.c: Include specification header before all other headers.
index 7e6f0d30e0c91d39745310b9be32a97a5ad20cd5..c1d7a1629621d15f10b1a39cf01197c1df323a91 100644 (file)
@@ -220,15 +220,6 @@ main (argc, argv)
        /* NOTREACHED */
       }
 
-  /* Verify selected options.  */
-  if (!line_comment && sort_by_filepos)
-    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
-          "--no-location", "--sort-by-file");
-
-  if (sort_by_msgid && sort_by_filepos)
-    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
-          "--sort-output", "--sort-by-file");
-
   /* Version information requested.  */
   if (do_version)
     {
@@ -247,6 +238,21 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
   if (do_help)
     usage (EXIT_SUCCESS);
 
+  /* Verify selected options.  */
+  if (!line_comment && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--no-location", "--sort-by-file");
+
+  if (sort_by_msgid && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--sort-output", "--sort-by-file");
+
+  /* Check the message selection criteria for sanity.  */
+  if (more_than >= less_than || less_than < 2)
+    error (EXIT_FAILURE, 0,
+           _("impossible selection criteria specified (%d < n < %d)"),
+           more_than, less_than);
+
   /* Determine list of files we have to process.  */
   if (files_from != NULL)
     file_list = read_names_from_file (files_from);
@@ -256,12 +262,6 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
   for (cnt = optind; cnt < argc; ++cnt)
     string_list_append_unique (file_list, argv[cnt]);
 
-  /* Check the message selection criteria for sanity.  */
-  if (more_than >= less_than || less_than < 2)
-    error (EXIT_FAILURE, 0,
-           _("impossible selection criteria specified (%d < n < %d)"),
-           more_than, less_than);
-
   /* Read input files, then filter, convert and merge messages.  */
   result = catenate_msgdomain_list (file_list, to_code);
 
index 9abd8199852a5ebeb1d8b949c42235c7c5754de1..9382f1538be42079f6666b7b77e187445e1a4f27 100644 (file)
@@ -223,15 +223,6 @@ main (argc, argv)
        /* NOTREACHED */
       }
 
-  /* Verify selected options.  */
-  if (!line_comment && sort_by_filepos)
-    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
-          "--no-location", "--sort-by-file");
-
-  if (sort_by_msgid && sort_by_filepos)
-    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
-          "--sort-output", "--sort-by-file");
-
   /* Version information requested.  */
   if (do_version)
     {
@@ -250,6 +241,15 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
   if (do_help)
     usage (EXIT_SUCCESS);
 
+  /* Verify selected options.  */
+  if (!line_comment && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--no-location", "--sort-by-file");
+
+  if (sort_by_msgid && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--sort-output", "--sort-by-file");
+
   /* Determine list of files we have to process.  */
   if (files_from != NULL)
     file_list = read_names_from_file (files_from);
index 8da868521557e67e99be8a866d42c84ddbebd56d..4ec75162fd8efa6b24764ac4f907f517a5c0514d 100644 (file)
@@ -202,6 +202,11 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
       usage (EXIT_FAILURE);
     }
 
+  /* Verify selected options.  */
+  if (!line_comment && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--no-location", "--sort-by-file");
+
   if (sort_by_msgid && sort_by_filepos)
     error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
           "--sort-output", "--sort-by-file");
index e8b7110892edba728ac086443be903d169fccd42..e4526b959221ee29545f1070ca690e4f70756f46 100644 (file)
@@ -191,6 +191,11 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
       usage (EXIT_FAILURE);
     }
 
+  /* Verify selected options.  */
+  if (!line_comment && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--no-location", "--sort-by-file");
+
   if (sort_by_msgid && sort_by_filepos)
     error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
           "--sort-output", "--sort-by-file");
index b56aaf4535b1f788ae65acb32a29825bb9878671..0445866eaec45c79676369687592a280e6048e13 100644 (file)
@@ -248,6 +248,15 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
     error (EXIT_FAILURE, 0, _("missing filter name"));
   sub_name = argv[optind];
 
+  /* Verify selected options.  */
+  if (!line_comment && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--no-location", "--sort-by-file");
+
+  if (sort_by_msgid && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--sort-output", "--sort-by-file");
+
   /* Build argument list for the program.  */
   sub_argc = argc - optind;
   sub_argv = (char **) xmalloc ((sub_argc + 1) * sizeof (char *));
@@ -279,10 +288,6 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
        }
     }
 
-  if (sort_by_msgid && sort_by_filepos)
-    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
-          "--sort-output", "--sort-by-file");
-
   /* By default, input comes from standard input.  */
   if (input_file == NULL)
     input_file = "-";
index a75b7344044038455a86bf5881b87d9119a071fc..de1ab4f56bbddb180feaa8b5ad2c922188cb6272 100644 (file)
@@ -295,6 +295,11 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
       usage (EXIT_FAILURE);
     }
 
+  /* Verify selected options.  */
+  if (!line_comment && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--no-location", "--sort-by-file");
+
   if (sort_by_msgid && sort_by_filepos)
     error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
           "--sort-output", "--sort-by-file");
index 0143ee77ebf9ffd9ee10a6fbda29acea83ee8d5d..da5003ac71653e481db4e2f341a11fde7241c645 100644 (file)
@@ -244,9 +244,14 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
       usage (EXIT_FAILURE);
     }
 
+  /* Verify selected options.  */
+  if (!line_comment && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--no-location", "--sort-by-file");
+
   if (sort_by_msgid && sort_by_filepos)
     error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
-           "--sort-output", "--sort-by-file");
+          "--sort-output", "--sort-by-file");
 
   /* merge the two files */
   result = merge (argv[optind], argv[optind + 1]);
index c3d80900d9edc59c9afadfa6f1730882551889d8..ebaae5f27e8579030414072387429ed1c4b886ad 100644 (file)
@@ -198,15 +198,6 @@ main (argc, argv)
        /* NOTREACHED */
       }
 
-  /* Verify selected options.  */
-  if (!line_comment && sort_by_filepos)
-    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
-          "--no-location", "--sort-by-file");
-
-  if (sort_by_msgid && sort_by_filepos)
-    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
-          "--sort-output", "--sort-by-file");
-
   /* Version information requested.  */
   if (do_version)
     {
@@ -236,6 +227,15 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
       usage (EXIT_FAILURE);
     }
 
+  /* Verify selected options.  */
+  if (!line_comment && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--no-location", "--sort-by-file");
+
+  if (sort_by_msgid && sort_by_filepos)
+    error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
+          "--sort-output", "--sort-by-file");
+
   /* Determine list of files we have to process: a single file.  */
   file_list = string_list_alloc ();
   string_list_append (file_list, input_file);
index 2a61815ca136057338d345bed44eb591f4175e05..890362e715aa7a23aa13ee8483812986650042e5 100644 (file)
@@ -346,10 +346,29 @@ main (argc, argv)
        /* NOTREACHED */
       }
 
+  /* Version information requested.  */
+  if (do_version)
+    {
+      printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION);
+      /* xgettext: no-wrap */
+      printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\
+This is free software; see the source for copying conditions.  There is NO\n\
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
+"),
+             "1995-1998, 2000, 2001");
+      printf (_("Written by %s.\n"), "Ulrich Drepper");
+      exit (EXIT_SUCCESS);
+    }
+
+  /* Help is requested.  */
+  if (do_help)
+    usage (EXIT_SUCCESS);
+
   /* Normalize selected options.  */
   if (omit_header != 0 && line_comment < 0)
     line_comment = 0;
 
+  /* Verify selected options.  */
   if (!line_comment && sort_by_filepos)
     error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
           "--no-location", "--sort-by-file");
@@ -369,24 +388,6 @@ xgettext cannot work without keywords to look for"));
       usage (EXIT_FAILURE);
     }
 
-  /* Version information requested.  */
-  if (do_version)
-    {
-      printf ("%s (GNU %s) %s\n", basename (program_name), PACKAGE, VERSION);
-      /* xgettext: no-wrap */
-      printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\
-This is free software; see the source for copying conditions.  There is NO\n\
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"),
-             "1995-1998, 2000, 2001");
-      printf (_("Written by %s.\n"), "Ulrich Drepper");
-      exit (EXIT_SUCCESS);
-    }
-
-  /* Help is requested.  */
-  if (do_help)
-    usage (EXIT_SUCCESS);
-
   /* Test whether we have some input files given.  */
   if (files_from == NULL && optind >= argc)
     {