From: Bruno Haible Date: Wed, 25 Jun 2025 02:15:58 +0000 (+0200) Subject: gettext-runtime: Improve --help output. X-Git-Tag: v0.26~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adf6e5709b471e8a98d5370476b5630a0b703140;p=thirdparty%2Fgettext.git gettext-runtime: Improve --help output. * gettext-runtime/src/gettext.c (usage): Add section title "Options and arguments". * gettext-runtime/src/ngettext.c (usage): Likewise. * gettext-runtime/doc/rt-gettext.texi: Add section titles "Options and arguments" and "Informative output". * gettext-runtime/doc/rt-ngettext.texi: Likewise. --- diff --git a/gettext-runtime/doc/rt-gettext.texi b/gettext-runtime/doc/rt-gettext.texi index dc6a97693..f6e50ee74 100644 --- a/gettext-runtime/doc/rt-gettext.texi +++ b/gettext-runtime/doc/rt-gettext.texi @@ -1,5 +1,5 @@ @c This file is part of the GNU gettext manual. -@c Copyright (C) 1995-2019 Free Software Foundation, Inc. +@c Copyright (C) 1995-2025 Free Software Foundation, Inc. @c See the file gettext.texi for copying conditions. @pindex gettext @@ -13,7 +13,7 @@ gettext [@var{option}] -s [@var{msgid}]... The @code{gettext} program displays the native language translation of a textual message. -@noindent @strong{Arguments} +@noindent @strong{Options and arguments} @table @samp @item -c @var{context} @@ -43,26 +43,31 @@ interpreted like the System V @samp{echo} program did. This option is only for compatibility with the @samp{echo} program or shell built-in. It has no effect. +@item -n +@opindex -n@r{, @code{gettext} option} +This option has only an effect if the @code{-s} option is given. It +suppresses the additional newline at the end. + +@item [@var{textdomain}] @var{msgid} +Retrieve translated message corresponding to @var{msgid} from @var{textdomain}. + +@end table + +@noindent @strong{Informative output} + +@table @samp @item -h @itemx --help @opindex -h@r{, @code{gettext} option} @opindex --help@r{, @code{gettext} option} Display this help and exit. -@item -n -@opindex -n@r{, @code{gettext} option} -This option has only an effect if the @code{-s} option is given. It -suppresses the additional newline at the end. - @item -V @itemx --version @opindex -V@r{, @code{gettext} option} @opindex --version@r{, @code{gettext} option} Output version information and exit. -@item [@var{textdomain}] @var{msgid} -Retrieve translated message corresponding to @var{msgid} from @var{textdomain}. - @end table If the @var{textdomain} parameter is not given, the domain is determined from diff --git a/gettext-runtime/doc/rt-ngettext.texi b/gettext-runtime/doc/rt-ngettext.texi index abdcc9adb..be1fb4bea 100644 --- a/gettext-runtime/doc/rt-ngettext.texi +++ b/gettext-runtime/doc/rt-ngettext.texi @@ -1,5 +1,5 @@ @c This file is part of the GNU gettext manual. -@c Copyright (C) 1995-2019 Free Software Foundation, Inc. +@c Copyright (C) 1995-2025 Free Software Foundation, Inc. @c See the file gettext.texi for copying conditions. @pindex ngettext @@ -12,7 +12,7 @@ ngettext [@var{option}] [@var{textdomain}] @var{msgid} @var{msgid-plural} @var{c The @code{ngettext} program displays the native language translation of a textual message whose grammatical form depends on a number. -@noindent @strong{Arguments} +@noindent @strong{Options and arguments} @table @samp @item -c @var{context} @@ -42,6 +42,20 @@ interpreted like the System V @samp{echo} program did. This option is only for compatibility with the @samp{gettext} program. It has no effect. +@item @var{textdomain} +Retrieve translated message from @var{textdomain}. + +@item @var{msgid} @var{msgid-plural} +Translate @var{msgid} (English singular) / @var{msgid-plural} (English plural). + +@item @var{count} +Choose singular/plural form based on this value. + +@end table + +@noindent @strong{Informative output} + +@table @samp @item -h @itemx --help @opindex -h@r{, @code{ngettext} option} @@ -54,15 +68,6 @@ Display this help and exit. @opindex --version@r{, @code{ngettext} option} Output version information and exit. -@item @var{textdomain} -Retrieve translated message from @var{textdomain}. - -@item @var{msgid} @var{msgid-plural} -Translate @var{msgid} (English singular) / @var{msgid-plural} (English plural). - -@item @var{count} -Choose singular/plural form based on this value. - @end table If the @var{textdomain} parameter is not given, the domain is determined from diff --git a/gettext-runtime/src/gettext.c b/gettext-runtime/src/gettext.c index 6ae28c8ea..fa39ea892 100644 --- a/gettext-runtime/src/gettext.c +++ b/gettext-runtime/src/gettext.c @@ -96,36 +96,36 @@ main (int argc, char *argv[]) while ((optchar = getopt_long (argc, argv, "+c:d:eEhnsV", long_options, NULL)) != EOF) switch (optchar) - { - case '\0': /* Long option. */ - break; - case 'c': - context = optarg; - break; - case 'd': - domain = optarg; - break; - case 'e': - do_expand = true; - break; - case 'E': - /* Ignore. Just for compatibility. */ - break; - case 'h': - do_help = true; - break; - case 'n': - inhibit_added_newline = true; - break; - case 's': - do_shell = true; - break; - case 'V': - do_version = true; - break; - default: - usage (EXIT_FAILURE); - } + { + case '\0': /* Long option. */ + break; + case 'c': + context = optarg; + break; + case 'd': + domain = optarg; + break; + case 'e': + do_expand = true; + break; + case 'E': + /* Ignore. Just for compatibility. */ + break; + case 'h': + do_help = true; + break; + case 'n': + inhibit_added_newline = true; + break; + case 's': + do_shell = true; + break; + case 'V': + do_version = true; + break; + default: + usage (EXIT_FAILURE); + } /* Version information is requested. */ if (do_version) @@ -258,6 +258,8 @@ or: %s [OPTION] -s [MSGID]...\n\ printf (_("\ Display native language translation of a textual message.\n")); printf ("\n"); + printf (_("\ +Options and arguments:\n")); /* xgettext: no-wrap */ printf (_("\ -d, --domain=TEXTDOMAIN retrieve translated messages from TEXTDOMAIN\n")); diff --git a/gettext-runtime/src/ngettext.c b/gettext-runtime/src/ngettext.c index 737495e62..43dadad8d 100644 --- a/gettext-runtime/src/ngettext.c +++ b/gettext-runtime/src/ngettext.c @@ -93,30 +93,30 @@ main (int argc, char *argv[]) while ((optchar = getopt_long (argc, argv, "+c:d:eEhV", long_options, NULL)) != EOF) switch (optchar) - { - case '\0': /* Long option. */ - break; - case 'c': - context = optarg; - break; - case 'd': - domain = optarg; - break; - case 'e': - do_expand = true; - break; - case 'E': - /* Ignore. Just for compatibility. */ - break; - case 'h': - do_help = true; - break; - case 'V': - do_version = true; - break; - default: - usage (EXIT_FAILURE); - } + { + case '\0': /* Long option. */ + break; + case 'c': + context = optarg; + break; + case 'd': + domain = optarg; + break; + case 'e': + do_expand = true; + break; + case 'E': + /* Ignore. Just for compatibility. */ + break; + case 'h': + do_help = true; + break; + case 'V': + do_version = true; + break; + default: + usage (EXIT_FAILURE); + } /* Version information is requested. */ if (do_version) @@ -226,6 +226,8 @@ Usage: %s [OPTION] [TEXTDOMAIN] MSGID MSGID-PLURAL COUNT\n\ Display native language translation of a textual message whose grammatical\n\ form depends on a number.\n")); printf ("\n"); + printf (_("\ +Options and arguments:\n")); /* xgettext: no-wrap */ printf (_("\ -d, --domain=TEXTDOMAIN retrieve translated message from TEXTDOMAIN\n"));