1 /* Print --version and bug-reporting information in a consistent format.
2 Copyright (C) 1999-2016 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Written by Jim Meyering. */
22 #include "version-etc.h"
29 # include "unlocked-io.h"
33 #define _(msgid) gettext (msgid)
35 /* If you use AM_INIT_AUTOMAKE's no-define option,
36 PACKAGE is not defined. Use PACKAGE_TARNAME instead. */
37 #if ! defined PACKAGE && defined PACKAGE_TARNAME
38 # define PACKAGE PACKAGE_TARNAME
41 enum { COPYRIGHT_YEAR = 2016 };
43 /* The three functions below display the --version information the
46 If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
47 the program. The formats are therefore:
53 COMMAND_NAME (PACKAGE) VERSION.
55 The functions differ in the way they are passed author names. */
57 /* Display the --version information the standard way.
59 Author names are given in the array AUTHORS. N_AUTHORS is the
60 number of elements in the array. */
62 version_etc_arn (FILE *stream,
63 const char *command_name, const char *package,
65 const char * const * authors, size_t n_authors)
68 fprintf (stream, "%s (%s) %s\n", command_name, package, version);
70 fprintf (stream, "%s %s\n", package, version);
72 #ifdef PACKAGE_PACKAGER
73 # ifdef PACKAGE_PACKAGER_VERSION
74 fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER,
75 PACKAGE_PACKAGER_VERSION);
77 fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER);
81 /* TRANSLATORS: Translate "(C)" to the copyright symbol
82 (C-in-a-circle), if this symbol is available in the user's
83 locale. Otherwise, do not translate "(C)"; leave it as-is. */
84 fprintf (stream, version_etc_copyright, _("(C)"), COPYRIGHT_YEAR);
88 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n\
89 This is free software: you are free to change and redistribute it.\n\
90 There is NO WARRANTY, to the extent permitted by law.\n\
98 /* The caller must provide at least one author name. */
101 /* TRANSLATORS: %s denotes an author name. */
102 fprintf (stream, _("Written by %s.\n"), authors[0]);
105 /* TRANSLATORS: Each %s denotes an author name. */
106 fprintf (stream, _("Written by %s and %s.\n"), authors[0], authors[1]);
109 /* TRANSLATORS: Each %s denotes an author name. */
110 fprintf (stream, _("Written by %s, %s, and %s.\n"),
111 authors[0], authors[1], authors[2]);
114 /* TRANSLATORS: Each %s denotes an author name.
115 You can use line breaks, estimating that each author name occupies
116 ca. 16 screen columns and that a screen line has ca. 80 columns. */
117 fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"),
118 authors[0], authors[1], authors[2], authors[3]);
121 /* TRANSLATORS: Each %s denotes an author name.
122 You can use line breaks, estimating that each author name occupies
123 ca. 16 screen columns and that a screen line has ca. 80 columns. */
124 fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"),
125 authors[0], authors[1], authors[2], authors[3], authors[4]);
128 /* TRANSLATORS: Each %s denotes an author name.
129 You can use line breaks, estimating that each author name occupies
130 ca. 16 screen columns and that a screen line has ca. 80 columns. */
131 fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
132 authors[0], authors[1], authors[2], authors[3], authors[4],
136 /* TRANSLATORS: Each %s denotes an author name.
137 You can use line breaks, estimating that each author name occupies
138 ca. 16 screen columns and that a screen line has ca. 80 columns. */
139 fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
140 authors[0], authors[1], authors[2], authors[3], authors[4],
141 authors[5], authors[6]);
144 /* TRANSLATORS: Each %s denotes an author name.
145 You can use line breaks, estimating that each author name occupies
146 ca. 16 screen columns and that a screen line has ca. 80 columns. */
147 fprintf (stream, _("\
148 Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
149 authors[0], authors[1], authors[2], authors[3], authors[4],
150 authors[5], authors[6], authors[7]);
153 /* TRANSLATORS: Each %s denotes an author name.
154 You can use line breaks, estimating that each author name occupies
155 ca. 16 screen columns and that a screen line has ca. 80 columns. */
156 fprintf (stream, _("\
157 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
158 authors[0], authors[1], authors[2], authors[3], authors[4],
159 authors[5], authors[6], authors[7], authors[8]);
162 /* 10 or more authors. Use an abbreviation, since the human reader
163 will probably not want to read the entire list anyway. */
164 /* TRANSLATORS: Each %s denotes an author name.
165 You can use line breaks, estimating that each author name occupies
166 ca. 16 screen columns and that a screen line has ca. 80 columns. */
167 fprintf (stream, _("\
168 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
169 authors[0], authors[1], authors[2], authors[3], authors[4],
170 authors[5], authors[6], authors[7], authors[8]);
175 /* Display the --version information the standard way. See the initial
176 comment to this module, for more information.
178 Author names are given in the NULL-terminated array AUTHORS. */
180 version_etc_ar (FILE *stream,
181 const char *command_name, const char *package,
182 const char *version, const char * const * authors)
186 for (n_authors = 0; authors[n_authors]; n_authors++)
188 version_etc_arn (stream, command_name, package, version, authors, n_authors);
191 /* Display the --version information the standard way. See the initial
192 comment to this module, for more information.
194 Author names are given in the NULL-terminated va_list AUTHORS. */
196 version_etc_va (FILE *stream,
197 const char *command_name, const char *package,
198 const char *version, va_list authors)
201 const char *authtab[10];
205 && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
208 version_etc_arn (stream, command_name, package, version,
213 /* Display the --version information the standard way.
215 If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
216 the program. The formats are therefore:
222 COMMAND_NAME (PACKAGE) VERSION.
224 The authors names are passed as separate arguments, with an additional
225 NULL argument at the end. */
227 version_etc (FILE *stream,
228 const char *command_name, const char *package,
229 const char *version, /* const char *author1, ...*/ ...)
233 va_start (authors, version);
234 version_etc_va (stream, command_name, package, version, authors);
239 emit_bug_reporting_address (void)
241 /* TRANSLATORS: The placeholder indicates the bug-reporting address
242 for this package. Please add _another line_ saying
243 "Report translation bugs to <...>\n" with the address for translation
244 bugs (typically your translation team's web or email address). */
245 printf (_("\nReport bugs to: %s\n"), PACKAGE_BUGREPORT);
246 #ifdef PACKAGE_PACKAGER_BUG_REPORTS
247 printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER,
248 PACKAGE_PACKAGER_BUG_REPORTS);
251 printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
253 printf (_("%s home page: <http://www.gnu.org/software/%s/>\n"),
254 PACKAGE_NAME, PACKAGE);
256 fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>\n"),