summaryrefslogtreecommitdiffstats
path: root/gettext-tools/src/xgettext.c
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2014-03-24 18:43:01 +0900
committerDaiki Ueno <ueno@gnu.org>2014-03-25 17:05:41 +0900
commit90c76fda268779b80c2fa969b8efddbb4aa5da1e (patch)
tree35736c9950945b19fad8244a89907d20d29c2b5b /gettext-tools/src/xgettext.c
parent0c94b1c6d7a118b64e50644242cd498b60bfa518 (diff)
downloadexternal_gettext-90c76fda268779b80c2fa969b8efddbb4aa5da1e.zip
external_gettext-90c76fda268779b80c2fa969b8efddbb4aa5da1e.tar.gz
external_gettext-90c76fda268779b80c2fa969b8efddbb4aa5da1e.tar.bz2
Extend --add-location option to suppress line number output
The --add-location option of msgattrib, msgcat, msgcomm, msgconv, msgen, msgfilter, msggrep, msgmerge, msguniq, and xgettext commands now takes an optional argument 'never', 'full', or 'file', to control the format of "#: ..." comments. The default catalog reader changed to always remember file positions so the line number part can be suppressed in output phase rather than input phase.
Diffstat (limited to 'gettext-tools/src/xgettext.c')
-rw-r--r--gettext-tools/src/xgettext.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c
index 8e89a33..8f14b93 100644
--- a/gettext-tools/src/xgettext.c
+++ b/gettext-tools/src/xgettext.c
@@ -199,7 +199,7 @@ iconv_t xgettext_current_source_iconv;
static const struct option long_options[] =
{
{ "add-comments", optional_argument, NULL, 'c' },
- { "add-location", no_argument, &line_comment, 1 },
+ { "add-location", optional_argument, NULL, 'n' },
{ "boost", no_argument, NULL, CHAR_MAX + 11 },
{ "c++", no_argument, NULL, 'C' },
{ "color", optional_argument, NULL, CHAR_MAX + 14 },
@@ -225,7 +225,7 @@ static const struct option long_options[] =
{ "msgstr-prefix", optional_argument, NULL, 'm' },
{ "msgstr-suffix", optional_argument, NULL, 'M' },
{ "no-escape", no_argument, NULL, 'e' },
- { "no-location", no_argument, &line_comment, 0 },
+ { "no-location", no_argument, NULL, CHAR_MAX + 16 },
{ "no-wrap", no_argument, NULL, CHAR_MAX + 4 },
{ "omit-header", no_argument, &xgettext_omit_header, 1 },
{ "output", required_argument, NULL, 'o' },
@@ -473,7 +473,8 @@ main (int argc, char *argv[])
break;
case 'n':
- line_comment = 1;
+ if (handle_filepos_comment_option (optarg))
+ usage (EXIT_FAILURE);
break;
case 'o':
@@ -587,6 +588,10 @@ main (int argc, char *argv[])
handle_style_option (optarg);
break;
+ case CHAR_MAX + 16: /* --no-location */
+ message_print_style_filepos (filepos_comment_none);
+ break;
+
default:
usage (EXIT_FAILURE);
/* NOTREACHED */
@@ -612,10 +617,6 @@ There is NO WARRANTY, to the extent permitted by law.\n\
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");
@@ -2474,8 +2475,7 @@ meta information, not the empty string.\n")));
warn_format_string (is_format, mp->msgid, pos, "msgid");
/* Remember where we saw this msgid. */
- if (line_comment)
- message_comment_filepos (mp, pos->file_name, pos->line_number);
+ message_comment_filepos (mp, pos->file_name, pos->line_number);
/* Tell the lexer to reset its comment buffer, so that the next
message gets the correct comments. */