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. */
54 __va_copy (tmp_authors, authors);
56 tmp_authors = authors;
60 while (va_arg (tmp_authors, const char *) != NULL)
65 fprintf (stream, "%s (%s) %s\n", command_name, package, version);
67 fprintf (stream, "%s %s\n", package, version);
69 /* TRANSLATORS: Translate "(C)" to the copyright symbol
70 (C-in-a-circle), if this symbol is available in the user's
71 locale. Otherwise, do not translate "(C)"; leave it as-is. */
72 fprintf (stream, version_etc_copyright, _("(C)"), COPYRIGHT_YEAR);
76 This is free software. You may redistribute copies of it under the terms of\n\
77 the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.\n\
78 There is NO WARRANTY, to the extent permitted by law.\n\
86 /* The caller must provide at least one author name. */
89 /* TRANSLATORS: %s denotes an author name. */
90 vfprintf (stream, _("Written by %s.\n"), authors);
93 /* TRANSLATORS: Each %s denotes an author name. */
94 vfprintf (stream, _("Written by %s and %s.\n"), authors);
97 /* TRANSLATORS: Each %s denotes an author name. */
98 vfprintf (stream, _("Written by %s, %s, and %s.\n"), authors);
101 /* TRANSLATORS: Each %s denotes an author name.
102 You can use line breaks, estimating that each author name occupies
103 ca. 16 screen columns and that a screen line has ca. 80 columns. */
104 vfprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"), authors);
107 /* TRANSLATORS: Each %s denotes an author name.
108 You can use line breaks, estimating that each author name occupies
109 ca. 16 screen columns and that a screen line has ca. 80 columns. */
110 vfprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"), authors);
113 /* TRANSLATORS: Each %s denotes an author name.
114 You can use line breaks, estimating that each author name occupies
115 ca. 16 screen columns and that a screen line has ca. 80 columns. */
116 vfprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
120 /* TRANSLATORS: Each %s denotes an author name.
121 You can use line breaks, estimating that each author name occupies
122 ca. 16 screen columns and that a screen line has ca. 80 columns. */
123 vfprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
127 /* TRANSLATORS: Each %s denotes an author name.
128 You can use line breaks, estimating that each author name occupies
129 ca. 16 screen columns and that a screen line has ca. 80 columns. */
130 vfprintf (stream, _("\
131 Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
135 /* TRANSLATORS: Each %s denotes an author name.
136 You can use line breaks, estimating that each author name occupies
137 ca. 16 screen columns and that a screen line has ca. 80 columns. */
138 vfprintf (stream, _("\
139 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
143 /* 10 or more authors. Use an abbreviation, since the human reader
144 will probably not want to read the entire list anyway. */
145 /* TRANSLATORS: Each %s denotes an author name.
146 You can use line breaks, estimating that each author name occupies
147 ca. 16 screen columns and that a screen line has ca. 80 columns. */
148 vfprintf (stream, _("\
149 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
157 /* Display the --version information the standard way.
159 If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of
160 the program. The formats are therefore:
166 COMMAND_NAME (PACKAGE) VERSION.
168 The author names are passed as separate arguments, with an additional
169 NULL argument at the end. */
171 version_etc (FILE *stream,
172 const char *command_name, const char *package,
173 const char *version, /* const char *author1, ...*/ ...)
177 va_start (authors, version);
178 version_etc_va (stream, command_name, package, version, authors);