]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
New msgexec option --keep-header.
authorBruno Haible <bruno@clisp.org>
Mon, 10 Dec 2001 12:54:56 +0000 (12:54 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jun 2009 21:36:37 +0000 (23:36 +0200)
doc/ChangeLog
doc/msgexec.texi
src/ChangeLog
src/msgexec.c

index a3071cd8840f50c87eb78505c66a89e2120f2c42..50a22b6a24fed9634343ba262de5797b2c6fd408 100644 (file)
@@ -1,3 +1,7 @@
+2001-12-07  Bruno Haible  <bruno@clisp.org>
+
+       * msgexec.texi: Document option --keep-header.
+
 2001-12-05  Bruno Haible  <haible@clisp.cons.org>
 
        * matrix.texi: Update.
index c718e417d2f2eda150d8b5458c461c3293caf44b..2ced8d5f6d67110c25fb882f6033e8ccb8a482ad 100644 (file)
@@ -69,6 +69,11 @@ Always write an output file even if it contains no message.
 @item --indent
 Write the .po file using indented style.
 
+@item --keep-header
+Keep the header entry, i.e. the message with @samp{msgid ""}, unmodified,
+instead of filtering it.  By default, the header entry is subject to
+filtering like any other message.
+
 @item --no-location
 Do not write @samp{#: @var{filename}:@var{line}} lines.
 
index 367833905abd503966d03d679af206b7ce794beb..db7bdea179f77bd778248e8576c1a21c4be05442 100644 (file)
@@ -1,3 +1,10 @@
+2001-12-07  Bruno Haible  <bruno@clisp.org>
+
+       * msgexec.c (keep_header): New variable.
+       (long_options): New option --keep-header.
+       (usage): Document option --keep-header.
+       (process_message): Implement --keep-header.
+
 2001-12-06  Bruno Haible  <bruno@clisp.org>
 
        * format.h (struct formatstring_parser): Add 'noisy' argument to
index b73c1ef988841f2dccde9aafcb80927a4d59d06c..4fca57d9c79d95700c770b79912a92718f9d902e 100644 (file)
@@ -71,6 +71,9 @@
 /* Force output of PO file even if empty.  */
 static int force_po;
 
+/* Keep the header entry unmodified.  */
+static int keep_header;
+
 /* Name of the subprogram.  */
 static const char *sub_name;
 
@@ -91,6 +94,7 @@ static const struct option long_options[] =
   { "help", no_argument, NULL, 'h' },
   { "indent", no_argument, NULL, CHAR_MAX + 1 },
   { "input", required_argument, NULL, 'i' },
+  { "keep-header", no_argument, &keep_header, 1 },
   { "no-escape", no_argument, NULL, CHAR_MAX + 2 },
   { "no-location", no_argument, &line_comment, 0 },
   { "output-file", required_argument, NULL, 'o' },
@@ -392,6 +396,7 @@ Output details:\n\
   -E, --escape                use C escapes in output, no extended chars\n\
       --force-po              write PO file even if empty\n\
       --indent                indented output style\n\
+      --keep-header           keep header entry unmodified, don't filter it\n\
       --no-location           suppress '#: filename:line' lines\n\
       --add-location          preserve '#: filename:line' lines (default)\n\
       --strict                strict Uniforum output style\n\
@@ -679,6 +684,10 @@ process_message (mp)
   char *q;
   size_t k;
 
+  /* Keep the header entry unmodified, if --keep-header was given.  */
+  if (mp->msgid[0] == '\0' && keep_header)
+    return;
+
   /* Count NUL delimited substrings.  */
   for (p = msgstr, nsubstrings = 0;
        p < msgstr + msgstr_len;