~ubuntu-branches/debian/jessie/liblouis/jessie

« back to all changes in this revision

Viewing changes to gnulib/version-etc.c

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Thibault
  • Date: 2010-01-12 23:48:47 UTC
  • mto: (1.1.4 upstream) (5.2.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100112234847-ph9xdk3lrjdox6ks
ImportĀ upstreamĀ versionĀ 1.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Print --version and bug-reporting information in a consistent format.
 
2
   Copyright (C) 1999-2009 Free Software Foundation, Inc.
 
3
 
 
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.
 
8
 
 
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.
 
13
 
 
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/>.  */
 
16
 
 
17
/* Written by Jim Meyering. */
 
18
 
 
19
#include <config.h>
 
20
 
 
21
/* Specification.  */
 
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
enum { COPYRIGHT_YEAR = 2009 };
 
36
 
 
37
/* The three functions below display the --version information the
 
38
   standard way.
 
39
 
 
40
   If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
 
41
   the program.  The formats are therefore:
 
42
 
 
43
   PACKAGE VERSION
 
44
 
 
45
   or
 
46
 
 
47
   COMMAND_NAME (PACKAGE) VERSION.
 
48
 
 
49
   The functions differ in the way they are passed author names. */
 
50
 
 
51
/* Display the --version information the standard way.
 
52
 
 
53
   Author names are given in the array AUTHORS. N_AUTHORS is the
 
54
   number of elements in the array. */
 
55
void
 
56
version_etc_arn (FILE *stream,
 
57
                 const char *command_name, const char *package,
 
58
                 const char *version,
 
59
                 const char * const * authors, size_t n_authors)
 
60
{
 
61
  if (command_name)
 
62
    fprintf (stream, "%s (%s) %s\n", command_name, package, version);
 
63
  else
 
64
    fprintf (stream, "%s %s\n", package, version);
 
65
 
 
66
#ifdef PACKAGE_PACKAGER
 
67
# ifdef PACKAGE_PACKAGER_VERSION
 
68
  fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER,
 
69
           PACKAGE_PACKAGER_VERSION);
 
70
# else
 
71
  fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER);
 
72
# endif
 
73
#endif
 
74
 
 
75
  /* TRANSLATORS: Translate "(C)" to the copyright symbol
 
76
     (C-in-a-circle), if this symbol is available in the user's
 
77
     locale.  Otherwise, do not translate "(C)"; leave it as-is.  */
 
78
  fprintf (stream, version_etc_copyright, _("(C)"), COPYRIGHT_YEAR);
 
79
 
 
80
  fputs (_("\
 
81
\n\
 
82
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n\
 
83
This is free software: you are free to change and redistribute it.\n\
 
84
There is NO WARRANTY, to the extent permitted by law.\n\
 
85
\n\
 
86
"),
 
87
         stream);
 
88
 
 
89
  switch (n_authors)
 
90
    {
 
91
    case 0:
 
92
      /* The caller must provide at least one author name.  */
 
93
      abort ();
 
94
    case 1:
 
95
      /* TRANSLATORS: %s denotes an author name.  */
 
96
      fprintf (stream, _("Written by %s.\n"), authors[0]);
 
97
      break;
 
98
    case 2:
 
99
      /* TRANSLATORS: Each %s denotes an author name.  */
 
100
      fprintf (stream, _("Written by %s and %s.\n"), authors[0], authors[1]);
 
101
      break;
 
102
    case 3:
 
103
      /* TRANSLATORS: Each %s denotes an author name.  */
 
104
      fprintf (stream, _("Written by %s, %s, and %s.\n"),
 
105
               authors[0], authors[1], authors[2]);
 
106
      break;
 
107
    case 4:
 
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
      fprintf (stream, _("Written by %s, %s, %s,\nand %s.\n"),
 
112
               authors[0], authors[1], authors[2], authors[3]);
 
113
      break;
 
114
    case 5:
 
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
      fprintf (stream, _("Written by %s, %s, %s,\n%s, and %s.\n"),
 
119
               authors[0], authors[1], authors[2], authors[3], authors[4]);
 
120
      break;
 
121
    case 6:
 
122
      /* TRANSLATORS: Each %s denotes an author name.
 
123
         You can use line breaks, estimating that each author name occupies
 
124
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
 
125
      fprintf (stream, _("Written by %s, %s, %s,\n%s, %s, and %s.\n"),
 
126
               authors[0], authors[1], authors[2], authors[3], authors[4],
 
127
               authors[5]);
 
128
      break;
 
129
    case 7:
 
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, %s, and %s.\n"),
 
134
               authors[0], authors[1], authors[2], authors[3], authors[4],
 
135
               authors[5], authors[6]);
 
136
      break;
 
137
    case 8:
 
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, _("\
 
142
Written by %s, %s, %s,\n%s, %s, %s, %s,\nand %s.\n"),
 
143
                authors[0], authors[1], authors[2], authors[3], authors[4],
 
144
                authors[5], authors[6], authors[7]);
 
145
      break;
 
146
    case 9:
 
147
      /* TRANSLATORS: Each %s denotes an author name.
 
148
         You can use line breaks, estimating that each author name occupies
 
149
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
 
150
      fprintf (stream, _("\
 
151
Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, and %s.\n"),
 
152
               authors[0], authors[1], authors[2], authors[3], authors[4],
 
153
               authors[5], authors[6], authors[7], authors[8]);
 
154
      break;
 
155
    default:
 
156
      /* 10 or more authors.  Use an abbreviation, since the human reader
 
157
         will probably not want to read the entire list anyway.  */
 
158
      /* TRANSLATORS: Each %s denotes an author name.
 
159
         You can use line breaks, estimating that each author name occupies
 
160
         ca. 16 screen columns and that a screen line has ca. 80 columns.  */
 
161
      fprintf (stream, _("\
 
162
Written by %s, %s, %s,\n%s, %s, %s, %s,\n%s, %s, and others.\n"),
 
163
                authors[0], authors[1], authors[2], authors[3], authors[4],
 
164
                authors[5], authors[6], authors[7], authors[8]);
 
165
      break;
 
166
    }
 
167
}
 
168
 
 
169
/* Display the --version information the standard way.  See the initial
 
170
   comment to this module, for more information.
 
171
 
 
172
   Author names are given in the NULL-terminated array AUTHORS. */
 
173
void
 
174
version_etc_ar (FILE *stream,
 
175
                const char *command_name, const char *package,
 
176
                const char *version, const char * const * authors)
 
177
{
 
178
  size_t n_authors;
 
179
 
 
180
  for (n_authors = 0; authors[n_authors]; n_authors++)
 
181
    ;
 
182
  version_etc_arn (stream, command_name, package, version, authors, n_authors);
 
183
}
 
184
 
 
185
/* Display the --version information the standard way.  See the initial
 
186
   comment to this module, for more information.
 
187
 
 
188
   Author names are given in the NULL-terminated va_list AUTHORS. */
 
189
void
 
190
version_etc_va (FILE *stream,
 
191
                const char *command_name, const char *package,
 
192
                const char *version, va_list authors)
 
193
{
 
194
  size_t n_authors;
 
195
  const char *authtab[10];
 
196
 
 
197
  for (n_authors = 0;
 
198
       n_authors < 10
 
199
         && (authtab[n_authors] = va_arg (authors, const char *)) != NULL;
 
200
       n_authors++)
 
201
    ;
 
202
  version_etc_arn (stream, command_name, package, version,
 
203
                   authtab, n_authors);
 
204
}
 
205
 
 
206
 
 
207
/* Display the --version information the standard way.
 
208
 
 
209
   If COMMAND_NAME is NULL, the PACKAGE is assumed to be the name of
 
210
   the program.  The formats are therefore:
 
211
 
 
212
   PACKAGE VERSION
 
213
 
 
214
   or
 
215
 
 
216
   COMMAND_NAME (PACKAGE) VERSION.
 
217
 
 
218
   The authors names are passed as separate arguments, with an additional
 
219
   NULL argument at the end.  */
 
220
void
 
221
version_etc (FILE *stream,
 
222
             const char *command_name, const char *package,
 
223
             const char *version, /* const char *author1, ...*/ ...)
 
224
{
 
225
  va_list authors;
 
226
 
 
227
  va_start (authors, version);
 
228
  version_etc_va (stream, command_name, package, version, authors);
 
229
  va_end (authors);
 
230
}
 
231
 
 
232
void
 
233
emit_bug_reporting_address (void)
 
234
{
 
235
  /* TRANSLATORS: The placeholder indicates the bug-reporting address
 
236
     for this package.  Please add _another line_ saying
 
237
     "Report translation bugs to <...>\n" with the address for translation
 
238
     bugs (typically your translation team's web or email address).  */
 
239
  printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
 
240
#ifdef PACKAGE_PACKAGER_BUG_REPORTS
 
241
  printf (_("Report %s bugs to <%s>.\n"), PACKAGE_PACKAGER,
 
242
          PACKAGE_PACKAGER_BUG_REPORTS);
 
243
#endif
 
244
  printf (_("%s home page: <http://www.gnu.org/software/%s/>.\n"),
 
245
          PACKAGE_NAME, PACKAGE);
 
246
  fputs (_("General help using GNU software: <http://www.gnu.org/gethelp/>.\n"),
 
247
         stdout);
 
248
}