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