1 /* Utility to help print --version output in a consistent format.
2 Copyright (C) 1999-2008 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 enum { COPYRIGHT_YEAR
= 2008 };
37 /* Like version_etc, below, but with the NULL-terminated author list
38 provided via a variable of type va_list. */
40 version_etc_va (FILE *stream
,
41 const char *command_name
, const char *package
,
42 const char *version
, va_list authors
)
46 /* Count the number of authors. */
50 va_copy (tmp_authors
, authors
);
53 while (va_arg (tmp_authors
, const char *) != NULL
)
58 fprintf (stream
, "%s (%s) %s\n", command_name
, package
, version
);
60 fprintf (stream
, "%s %s\n", package
, version
);
62 /* TRANSLATORS: Translate "(C)" to the copyright symbol
63 (C-in-a-circle), if this symbol is available in the user's
64 locale. Otherwise, do not translate "(C)"; leave it as-is. */
65 fprintf (stream
, version_etc_copyright
, _("(C)"), COPYRIGHT_YEAR
);
69 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
70 This is free software: you are free to change and redistribute it.\n\
71 There is NO WARRANTY, to the extent permitted by law.\n\
79 /* The caller must provide at least one author name. */
82 /* TRANSLATORS: %s denotes an author name. */
83 vfprintf (stream
, _("Written by %s.\n"), authors
);
86 /* TRANSLATORS: Each %s denotes an author name. */
87 vfprintf (stream
, _("Written by %s and %s.\n"), authors
);
90 /* TRANSLATORS: Each %s denotes an author name. */
91 vfprintf (stream
, _("Written by %s, %s, and %s.\n"), authors
);
94 /* TRANSLATORS: Each %s denotes an author name.
95 You can use line breaks, estimating that each author name occupies
96 ca. 16 screen columns and that a screen line has ca. 80 columns. */
97 vfprintf (stream
, _("Written by %s, %s, %s,\nand %s.\n"), authors
);
100 /* TRANSLATORS: Each %s denotes an author name.
101 You can use line breaks, estimating that each author name occupies
102 ca. 16 screen columns and that a screen line has ca. 80 columns. */
103 vfprintf (stream
, _("Written by %s, %s, %s,\n%s, and %s.\n"), authors
);
106 /* TRANSLATORS: Each %s denotes an author name.
107 You can use line breaks, estimating that each author name occupies
108 ca. 16 screen columns and that a screen line has ca. 80 columns. */
109 vfprintf (stream
, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
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, %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
, _("\
124 Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
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 vfprintf (stream
, _("\
132 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
136 /* 10 or more authors. Use an abbreviation, since the human reader
137 will probably not want to read the entire list anyway. */
138 /* TRANSLATORS: Each %s denotes an author name.
139 You can use line breaks, estimating that each author name occupies
140 ca. 16 screen columns and that a screen line has ca. 80 columns. */
141 vfprintf (stream
, _("\
142 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
150 /* Display the --version information the standard way.
152 If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of
153 the program. The formats are therefore:
159 COMMAND_NAME (PACKAGE) VERSION.
161 The author names are passed as separate arguments, with an additional
162 NULL argument at the end. */
164 version_etc (FILE *stream
,
165 const char *command_name
, const char *package
,
166 const char *version
, /* const char *author1, ...*/ ...)
170 va_start (authors
, version
);
171 version_etc_va (stream
, command_name
, package
, version
, authors
);