1 /* Utility to help print --version output in a consistent format.
2 Copyright (C) 1999-2006 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 2, or (at your option)
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, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 /* Written by Jim Meyering. */
25 #include "version-etc.h"
32 # include "unlocked-io.h"
36 #define _(msgid) gettext (msgid)
38 enum { COPYRIGHT_YEAR = 2006 };
40 /* Like version_etc, below, but with the NULL-terminated author list
41 provided via a variable of type va_list. */
43 version_etc_va (FILE *stream,
44 const char *command_name, const char *package,
45 const char *version, va_list authors)
49 /* Count the number of authors. */
53 va_copy (tmp_authors, authors);
56 while (va_arg (tmp_authors, const char *) != NULL)
61 fprintf (stream, "%s (%s) %s\n", command_name, package, version);
63 fprintf (stream, "%s %s\n", package, version);
65 /* TRANSLATORS: Translate "(C)" to the copyright symbol
66 (C-in-a-circle), if this symbol is available in the user's
67 locale. Otherwise, do not translate "(C)"; leave it as-is. */
68 fprintf (stream, version_etc_copyright, _("(C)"), COPYRIGHT_YEAR);
72 This is free software. You may redistribute copies of it under the terms of\n\
73 the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.\n\
74 There is NO WARRANTY, to the extent permitted by law.\n\
82 /* The caller must provide at least one author name. */
85 /* TRANSLATORS: %s denotes an author name. */
86 vfprintf (stream, _("Written by %s.\n"), authors);
89 /* TRANSLATORS: Each %s denotes an author name. */
90 vfprintf (stream, _("Written by %s and %s.\n"), authors);
93 /* TRANSLATORS: Each %s denotes an author name. */
94 vfprintf (stream, _("Written by %s, %s, and %s.\n"), authors);
97 /* TRANSLATORS: Each %s denotes an author name.
98 You can use line breaks, estimating that each author name occupies
99 ca. 16 screen columns and that a screen line has ca. 80 columns. */
100 vfprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"), authors);
103 /* TRANSLATORS: Each %s denotes an author name.
104 You can use line breaks, estimating that each author name occupies
105 ca. 16 screen columns and that a screen line has ca. 80 columns. */
106 vfprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"), authors);
109 /* TRANSLATORS: Each %s denotes an author name.
110 You can use line breaks, estimating that each author name occupies
111 ca. 16 screen columns and that a screen line has ca. 80 columns. */
112 vfprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
116 /* TRANSLATORS: Each %s denotes an author name.
117 You can use line breaks, estimating that each author name occupies
118 ca. 16 screen columns and that a screen line has ca. 80 columns. */
119 vfprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
123 /* TRANSLATORS: Each %s denotes an author name.
124 You can use line breaks, estimating that each author name occupies
125 ca. 16 screen columns and that a screen line has ca. 80 columns. */
126 vfprintf (stream, _("\
127 Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
131 /* TRANSLATORS: Each %s denotes an author name.
132 You can use line breaks, estimating that each author name occupies
133 ca. 16 screen columns and that a screen line has ca. 80 columns. */
134 vfprintf (stream, _("\
135 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
139 /* 10 or more authors. Use an abbreviation, since the human reader
140 will probably not want to read the entire list anyway. */
141 /* TRANSLATORS: Each %s denotes an author name.
142 You can use line breaks, estimating that each author name occupies
143 ca. 16 screen columns and that a screen line has ca. 80 columns. */
144 vfprintf (stream, _("\
145 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
153 /* Display the --version information the standard way.
155 If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of
156 the program. The formats are therefore:
162 COMMAND_NAME (PACKAGE) VERSION.
164 The author names are passed as separate arguments, with an additional
165 NULL argument at the end. */
167 version_etc (FILE *stream,
168 const char *command_name, const char *package,
169 const char *version, /* const char *author1, ...*/ ...)
173 va_start (authors, version);
174 version_etc_va (stream, command_name, package, version, authors);