This source file includes following definitions.
- version_etc_arn
- version_etc_ar
- version_etc_va
- version_etc
- emit_bug_reporting_address
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <config.h>
20
21
22 #include "version-etc.h"
23
24 #include <stdarg.h>
25 #include <stdio.h>
26
27 #if USE_UNLOCKED_IO
28 # include "unlocked-io.h"
29 #endif
30
31 #include "gettext.h"
32 #define _(msgid) gettext (msgid)
33
34
35
36 #if ! defined PACKAGE && defined PACKAGE_TARNAME
37 # define PACKAGE PACKAGE_TARNAME
38 #endif
39
40 enum { COPYRIGHT_YEAR = 2021 };
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 void
61 version_etc_arn (FILE *stream,
62 const char *command_name, const char *package,
63 const char *version,
64 const char * const * authors, size_t n_authors)
65 {
66 if (command_name)
67 fprintf (stream, "%s (%s) %s\n", command_name, package, version);
68 else
69 fprintf (stream, "%s %s\n", package, version);
70
71 #ifdef PACKAGE_PACKAGER
72 # ifdef PACKAGE_PACKAGER_VERSION
73 fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER,
74 PACKAGE_PACKAGER_VERSION);
75 # else
76 fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER);
77 # endif
78 #endif
79
80
81
82
83 fprintf (stream, version_etc_copyright, _("(C)"), COPYRIGHT_YEAR);
84
85 fputs ("\n", stream);
86
87
88 fprintf (stream, _("\
89 License GPLv3+: GNU GPL version 3 or later <%s>.\n\
90 This is free software: you are free to change and redistribute it.\n\
91 There is NO WARRANTY, to the extent permitted by law.\n\
92 "),
93 "https://gnu.org/licenses/gpl.html");
94
95 fputs ("\n", stream);
96
97 switch (n_authors)
98 {
99 case 0:
100
101
102 break;
103 case 1:
104
105 fprintf (stream, _("Written by %s.\n"), authors[0]);
106 break;
107 case 2:
108
109 fprintf (stream, _("Written by %s and %s.\n"), authors[0], authors[1]);
110 break;
111 case 3:
112
113 fprintf (stream, _("Written by %s, %s, and %s.\n"),
114 authors[0], authors[1], authors[2]);
115 break;
116 case 4:
117
118
119
120 fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"),
121 authors[0], authors[1], authors[2], authors[3]);
122 break;
123 case 5:
124
125
126
127 fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"),
128 authors[0], authors[1], authors[2], authors[3], authors[4]);
129 break;
130 case 6:
131
132
133
134 fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
135 authors[0], authors[1], authors[2], authors[3], authors[4],
136 authors[5]);
137 break;
138 case 7:
139
140
141
142 fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, %s, and %s.\n"),
143 authors[0], authors[1], authors[2], authors[3], authors[4],
144 authors[5], authors[6]);
145 break;
146 case 8:
147
148
149
150 fprintf (stream, _("\
151 Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
152 authors[0], authors[1], authors[2], authors[3], authors[4],
153 authors[5], authors[6], authors[7]);
154 break;
155 case 9:
156
157
158
159 fprintf (stream, _("\
160 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
161 authors[0], authors[1], authors[2], authors[3], authors[4],
162 authors[5], authors[6], authors[7], authors[8]);
163 break;
164 default:
165
166
167
168
169
170 fprintf (stream, _("\
171 Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
172 authors[0], authors[1], authors[2], authors[3], authors[4],
173 authors[5], authors[6], authors[7], authors[8]);
174 break;
175 }
176 }
177
178
179
180
181
182 void
183 version_etc_ar (FILE *stream,
184 const char *command_name, const char *package,
185 const char *version, const char * const * authors)
186 {
187 size_t n_authors;
188
189 for (n_authors = 0; authors[n_authors]; n_authors++)
190 ;
191 version_etc_arn (stream, command_name, package, version, authors, n_authors);
192 }
193
194
195
196
197
198 void
199 version_etc_va (FILE *stream,
200 const char *command_name, const char *package,
201 const char *version, va_list authors)
202 {
203 size_t n_authors;
204 const char *authtab[10];
205
206 for (n_authors = 0;
207 n_authors < 10
208 && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
209 n_authors++)
210 ;
211 version_etc_arn (stream, command_name, package, version,
212 authtab, n_authors);
213 }
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229 void
230 version_etc (FILE *stream,
231 const char *command_name, const char *package,
232 const char *version, ...)
233 {
234 va_list authors;
235
236 va_start (authors, version);
237 version_etc_va (stream, command_name, package, version, authors);
238 va_end (authors);
239 }
240
241 void
242 emit_bug_reporting_address (void)
243 {
244 fputs ("\n", stdout);
245
246
247
248
249 printf (_("Report bugs to: %s\n"), PACKAGE_BUGREPORT);
250 #ifdef PACKAGE_PACKAGER_BUG_REPORTS
251 printf (_("Report %s bugs to: %s\n"), PACKAGE_PACKAGER,
252 PACKAGE_PACKAGER_BUG_REPORTS);
253 #endif
254 #ifdef PACKAGE_URL
255 printf (_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
256 #else
257 printf (_("%s home page: <%s>\n"),
258 PACKAGE_NAME, "https://www.gnu.org/software/" PACKAGE "/");
259 #endif
260 printf (_("General help using GNU software: <%s>\n"),
261 "https://www.gnu.org/gethelp/");
262 }