1 /* Utility to help print --version output in a consistent format.
2 Copyright (C) 1999-2004 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /* Written by Jim Meyering. */
25 #include "version-etc.h"
30 #include "unlocked-io.h"
33 #define _(msgid) gettext (msgid)
35 /* Default copyright goes to the FSF. */
37 const char* version_etc_copyright
=
38 /* Do *not* mark this string for translation. */
39 "Copyright (C) 2004 Free Software Foundation, Inc.";
42 /* Like version_etc, below, but with the NULL-terminated author list
43 provided via a variable of type va_list. */
45 version_etc_va (FILE *stream
,
46 const char *command_name
, const char *package
,
47 const char *version
, va_list authors
)
49 unsigned int n_authors
;
51 /* Count the number of authors. */
56 __va_copy (tmp_authors
, authors
);
58 tmp_authors
= authors
;
62 while (va_arg (tmp_authors
, const char *) != NULL
)
67 fprintf (stream
, "%s (%s) %s\n", command_name
, package
, version
);
69 fprintf (stream
, "%s %s\n", package
, version
);
74 /* The caller must provide at least one author name. */
77 /* TRANSLATORS: %s denotes an author name. */
78 vfprintf (stream
, _("Written by %s.\n"), authors
);
81 /* TRANSLATORS: Each %s denotes an author name. */
82 vfprintf (stream
, _("Written by %s and %s.\n"), authors
);
85 /* TRANSLATORS: Each %s denotes an author name. */
86 vfprintf (stream
, _("Written by %s, %s, and %s.\n"), authors
);
89 /* TRANSLATORS: Each %s denotes an author name.
90 You can use line breaks, estimating that each author name occupies
91 ca. 16 screen columns and that a screen line has ca. 80 columns. */
92 vfprintf (stream
, _("Written by %s, %s, %s,\nand %s.\n"), authors
);
95 /* TRANSLATORS: Each %s denotes an author name.
96 You can use line breaks, estimating that each author name occupies
97 ca. 16 screen columns and that a screen line has ca. 80 columns. */
98 vfprintf (stream
, _("Written by %s, %s, %s,\n%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,\n%s, %s, and %s.\n"),
108 /* TRANSLATORS: Each %s denotes an author name.
109 You can use line breaks, estimating that each author name occupies
110 ca. 16 screen columns and that a screen line has ca. 80 columns. */
111 vfprintf (stream
, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
115 /* TRANSLATORS: Each %s denotes an author name.
116 You can use line breaks, estimating that each author name occupies
117 ca. 16 screen columns and that a screen line has ca. 80 columns. */
118 vfprintf (stream
, _("\
119 Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %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,\n%s, and %s.\n"),
131 /* 10 or more authors. Use an abbreviation, since the human reader
132 will probably not want to read the entire list anyway. */
133 /* TRANSLATORS: Each %s denotes an author name.
134 You can use line breaks, estimating that each author name occupies
135 ca. 16 screen columns and that a screen line has ca. 80 columns. */
136 vfprintf (stream
, _("\
137 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
144 fputs (version_etc_copyright
, stream
);
148 This is free software; see the source for copying conditions. There is NO\n\
149 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"),
154 /* Display the --version information the standard way.
156 If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of
157 the program. The formats are therefore:
163 COMMAND_NAME (PACKAGE) VERSION.
165 The author names are passed as separate arguments, with an additional
166 NULL argument at the end. */
168 version_etc (FILE *stream
,
169 const char *command_name
, const char *package
,
170 const char *version
, /* const char *author1, ...*/ ...)
174 va_start (authors
, version
);
175 version_etc_va (stream
, command_name
, package
, version
, authors
);