]> git.cworth.org Git - tar/blob - gnu/version-etc.c
upstream: Fix extraction of device nodes.
[tar] / gnu / version-etc.c
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Print --version and bug-reporting information in a consistent format.
4    Copyright (C) 1999-2010 Free Software Foundation, Inc.
5
6    This program is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19 /* Written by Jim Meyering. */
20
21 #include <config.h>
22
23 /* Specification.  */
24 #include "version-etc.h"
25
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29
30 #if USE_UNLOCKED_IO
31 # include "unlocked-io.h"
32 #endif
33
34 #include "gettext.h"
35 #define _(msgid) gettext (msgid)
36
37 /* If you use AM_INIT_AUTOMAKE's no-define option,
38    PACKAGE is not defined.  Use PACKAGE_TARNAME instead.  */
39 #if ! defined PACKAGE && defined PACKAGE_TARNAME
40 # define PACKAGE PACKAGE_TARNAME
41 #endif
42
43 enum { COPYRIGHT_YEAR = 2010 };
44
45 /* The three functions below display the --version information the
46    standard way.
47
48    If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
49    the program.  The formats are therefore:
50
51    PACKAGE VERSION
52
53    or
54
55    COMMAND_NAME (PACKAGE) VERSION.
56
57    The functions differ in the way they are passed author names. */
58
59 /* Display the --version information the standard way.
60
61    Author names are given in the array AUTHORS. N_AUTHORS is the
62    number of elements in the array. */
63 void
64 version_etc_arn (FILE *stream,
65                  const char *command_name, const char *package,
66                  const char *version,
67                  const char * const * authors, size_t n_authors)
68 {
69   if (command_name)
70     fprintf (stream, "%s (%s) %s\n", command_name, package, version);
71   else
72     fprintf (stream, "%s %s\n", package, version);
73
74 #ifdef PACKAGE_PACKAGER
75 # ifdef PACKAGE_PACKAGER_VERSION
76   fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER,
77            PACKAGE_PACKAGER_VERSION);
78 # else
79   fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER);
80 # endif
81 #endif
82
83   /* TRANSLATORS: Translate "(C)" to the copyright symbol
84      (C-in-a-circle), if this symbol is available in the user's
85      locale.  Otherwise, do not translate "(C)"; leave it as-is.  */
86   fprintf (stream, version_etc_copyright, _("(C)"), COPYRIGHT_YEAR);
87
88   fputs (_("\
89 \n\
90 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n\
91 This is free software: you are free to change and redistribute it.\n\
92 There is NO WARRANTY, to the extent permitted by law.\n\
93 \n\
94 "),
95          stream);
96
97   switch (n_authors)
98     {
99     case 0:
100       /* The caller must provide at least one author name.  */
101       abort ();
102     case 1:
103       /* TRANSLATORS: %s denotes an author name.  */
104       fprintf (stream, _("Written by %s.\n"), authors[0]);
105       break;
106     case 2:
107       /* TRANSLATORS: Each %s denotes an author name.  */
108       fprintf (stream, _("Written by %s and %s.\n"), authors[0], authors[1]);
109       break;
110     case 3:
111       /* TRANSLATORS: Each %s denotes an author name.  */
112       fprintf (stream, _("Written by %s, %s, and %s.\n"),
113                authors[0], authors[1], authors[2]);
114       break;
115     case 4:
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       fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"),
120                authors[0], authors[1], authors[2], authors[3]);
121       break;
122     case 5:
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       fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"),
127                authors[0], authors[1], authors[2], authors[3], authors[4]);
128       break;
129     case 6:
130       /* TRANSLATORS: Each %s denotes an author name.
131          You can use line breaks, estimating that each author name occupies
132          ca. 16 screen columns and that a screen line has ca. 80 columns.  */
133       fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
134                authors[0], authors[1], authors[2], authors[3], authors[4],
135                authors[5]);
136       break;
137     case 7:
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       fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
142                authors[0], authors[1], authors[2], authors[3], authors[4],
143                authors[5], authors[6]);
144       break;
145     case 8:
146       /* TRANSLATORS: Each %s denotes an author name.
147          You can use line breaks, estimating that each author name occupies
148          ca. 16 screen columns and that a screen line has ca. 80 columns.  */
149       fprintf (stream, _("\
150 Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
151                 authors[0], authors[1], authors[2], authors[3], authors[4],
152                 authors[5], authors[6], authors[7]);
153       break;
154     case 9:
155       /* TRANSLATORS: Each %s denotes an author name.
156          You can use line breaks, estimating that each author name occupies
157          ca. 16 screen columns and that a screen line has ca. 80 columns.  */
158       fprintf (stream, _("\
159 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
160                authors[0], authors[1], authors[2], authors[3], authors[4],
161                authors[5], authors[6], authors[7], authors[8]);
162       break;
163     default:
164       /* 10 or more authors.  Use an abbreviation, since the human reader
165          will probably not want to read the entire list anyway.  */
166       /* TRANSLATORS: Each %s denotes an author name.
167          You can use line breaks, estimating that each author name occupies
168          ca. 16 screen columns and that a screen line has ca. 80 columns.  */
169       fprintf (stream, _("\
170 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
171                 authors[0], authors[1], authors[2], authors[3], authors[4],
172                 authors[5], authors[6], authors[7], authors[8]);
173       break;
174     }
175 }
176
177 /* Display the --version information the standard way.  See the initial
178    comment to this module, for more information.
179
180    Author names are given in the NULL-terminated array AUTHORS. */
181 void
182 version_etc_ar (FILE *stream,
183                 const char *command_name, const char *package,
184                 const char *version, const char * const * authors)
185 {
186   size_t n_authors;
187
188   for (n_authors = 0; authors[n_authors]; n_authors++)
189     ;
190   version_etc_arn (stream, command_name, package, version, authors, n_authors);
191 }
192
193 /* Display the --version information the standard way.  See the initial
194    comment to this module, for more information.
195
196    Author names are given in the NULL-terminated va_list AUTHORS. */
197 void
198 version_etc_va (FILE *stream,
199                 const char *command_name, const char *package,
200                 const char *version, va_list authors)
201 {
202   size_t n_authors;
203   const char *authtab[10];
204
205   for (n_authors = 0;
206        n_authors < 10
207          && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
208        n_authors++)
209     ;
210   version_etc_arn (stream, command_name, package, version,
211                    authtab, n_authors);
212 }
213
214
215 /* Display the --version information the standard way.
216
217    If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
218    the program.  The formats are therefore:
219
220    PACKAGE VERSION
221
222    or
223
224    COMMAND_NAME (PACKAGE) VERSION.
225
226    The authors names are passed as separate arguments, with an additional
227    NULL argument at the end.  */
228 void
229 version_etc (FILE *stream,
230              const char *command_name, const char *package,
231              const char *version, /* const char *author1, ...*/ ...)
232 {
233   va_list authors;
234
235   va_start (authors, version);
236   version_etc_va (stream, command_name, package, version, authors);
237   va_end (authors);
238 }
239
240 void
241 emit_bug_reporting_address (void)
242 {
243   /* TRANSLATORS: The placeholder indicates the bug-reporting address
244      for this package.  Please add _another line_ saying
245      "Report translation bugs to <...>\n" with the address for translation
246      bugs (typically your translation team's web or email address).  */
247   printf (_("\nReport bugs to: %s\n"), PACKAGE_BUGREPORT);
248 #ifdef PACKAGE_PACKAGER_BUG_REPORTS
249   printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER,
250           PACKAGE_PACKAGER_BUG_REPORTS);
251 #endif
252 #ifdef PACKAGE_URL
253   printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
254 #else
255   printf (_("%s home page: <http://www.gnu.org/software/%s/>\n"),
256           PACKAGE_NAME, PACKAGE);
257 #endif
258   fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>\n"),
259          stdout);
260 }