From: Bruno Haible Date: Mon, 22 Oct 2001 08:52:10 +0000 (+0000) Subject: Don't throw the header entry away if --omit-header has been given. X-Git-Tag: v0.11~435 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3322f2f3b58cc37f3f8cadb0554b5f44470e97f4;p=thirdparty%2Fgettext.git Don't throw the header entry away if --omit-header has been given. --- diff --git a/src/ChangeLog b/src/ChangeLog index 5c71997b6..f2d024af7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2001-09-19 Bruno Haible + + * xgettext.h (omit_header): New declaration. + * xgettext.c (omit_header): Make global. + * x-po.c (extract_directive_message): Don't throw the header entry + away if omit_header is true. + 2001-09-19 Bruno Haible * write-po.c (msgdomain_list_print): Treat charset=CHARSET as if it diff --git a/src/x-po.c b/src/x-po.c index debedb8af..f30f6ca11 100644 --- a/src/x-po.c +++ b/src/x-po.c @@ -127,9 +127,11 @@ extract_directive_message (that, msgid, msgid_pos, msgid_plural, if (exclude != NULL && message_list_search (exclude, msgid) != NULL) goto discard; - /* If the msgid is the empty string, it is the old header. - Throw it away, we have constructed a new one. */ - if (*msgid == '\0') + /* If the msgid is the empty string, it is the old header. Throw it + away, we have constructed a new one. + But if no new one was constructed, keep the old header. This is useful + because the old header may contain a charset= directive. */ + if (*msgid == '\0' && !omit_header) { discard: free (msgid); diff --git a/src/xgettext.c b/src/xgettext.c index 3a71a0172..3f17d24f9 100644 --- a/src/xgettext.c +++ b/src/xgettext.c @@ -109,7 +109,7 @@ static const char *msgstr_suffix; static char *output_dir; /* If nonzero omit header with information about this run. */ -static int omit_header; +int omit_header; /* Long options. */ static const struct option long_options[] = diff --git a/src/xgettext.h b/src/xgettext.h index 6d8347568..8650ab79d 100644 --- a/src/xgettext.h +++ b/src/xgettext.h @@ -26,6 +26,8 @@ extern int line_comment; +extern int omit_header; + extern bool substring_match; /* List of messages whose msgids must not be extracted, or NULL.