/[m4]/m4/gnulib/m4/version-etc.c
ViewVC logotype

Diff of /m4/gnulib/m4/version-etc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by gary, Tue Sep 16 15:53:12 2003 UTC revision 1.2 by gary, Tue Oct 7 14:10:11 2003 UTC
# Line 21  Line 21 
21  # include <config.h>  # include <config.h>
22  #endif  #endif
23    
24    /* Specification.  */
25    #include "version-etc.h"
26    
27    #include <stdarg.h>
28  #include <stdio.h>  #include <stdio.h>
29    #include <stdlib.h>
30  #include "unlocked-io.h"  #include "unlocked-io.h"
 #include "version-etc.h"  
31    
32  #include "gettext.h"  #include "gettext.h"
33  #define _(msgid) gettext (msgid)  #define _(msgid) gettext (msgid)
34    
35  /* Default copyright goes to the FSF. */  /* Default copyright goes to the FSF. */
36    
37  char* version_etc_copyright =  const char* version_etc_copyright =
38    /* Do *not* mark this string for translation.  */    /* Do *not* mark this string for translation.  */
39    "Copyright (C) 2003 Free Software Foundation, Inc.";    "Copyright (C) 2003 Free Software Foundation, Inc.";
40    
41    
42  /* Display the --version information the standard way.  /* Like version_etc, below, but with the NULL-terminated author list
43       provided via a variable of type va_list.  */
44     If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of  void
45     the program.  The formats are therefore:  version_etc_va (FILE *stream,
46                    const char *command_name, const char *package,
47                    const char *version, va_list authors)
48    {
49      unsigned int n_authors;
50    
51     PACKAGE VERSION    /* Count the number of authors.  */
52      {
53        va_list tmp_authors;
54    
55    #ifdef __va_copy
56        __va_copy (tmp_authors, authors);
57    #else
58        tmp_authors = authors;
59    #endif
60    
61     or      n_authors = 0;
62        while (va_arg (tmp_authors, const char *) != NULL)
63          ++n_authors;
64      }
65    
    COMMAND_NAME (PACKAGE) VERSION.  */  
 void  
 version_etc (FILE *stream,  
              const char *command_name, const char *package,  
              const char *version, const char *authors)  
 {  
66    if (command_name)    if (command_name)
67      fprintf (stream, "%s (%s) %s\n", command_name, package, version);      fprintf (stream, "%s (%s) %s\n", command_name, package, version);
68    else    else
69      fprintf (stream, "%s %s\n", package, version);      fprintf (stream, "%s %s\n", package, version);
70    fprintf (stream, "%s\n", authors);  
71      switch (n_authors)
72        {
73        case 0:
74          /* The caller must provide at least one author name.  */
75          abort ();
76        case 1:
77          /* TRANSLATORS: %s denotes an author name.  */
78          vfprintf (stream, _("Written by %s.\n"), authors);
79          break;
80        case 2:
81          /* TRANSLATORS: Each %s denotes an author name.  */
82          vfprintf (stream, _("Written by %s and %s.\n"), authors);
83          break;
84        case 3:
85          /* TRANSLATORS: Each %s denotes an author name.  */
86          vfprintf (stream, _("Written by %s, %s, and %s.\n"), authors);
87          break;
88        case 4:
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);
93          break;
94        case 5:
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);
99          break;
100        case 6:
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"),
105                    authors);
106          break;
107        case 7:
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"),
112                    authors);
113          break;
114        case 8:
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"),
120                    authors);
121          break;
122        case 9:
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"),
128                    authors);
129          break;
130        default:
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"),
138                    authors);
139          break;
140        }
141      va_end (authors);
142    putc ('\n', stream);    putc ('\n', stream);
143    
144    fputs (version_etc_copyright, stream);    fputs (version_etc_copyright, stream);
# Line 65  This is free software; see the source fo Line 149  This is free software; see the source fo
149  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"),  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"),
150           stream);           stream);
151  }  }
152    
153    
154    /* Display the --version information the standard way.
155    
156       If COMMAND_NAME is NULL, the PACKAGE is asumed to be the name of
157       the program.  The formats are therefore:
158    
159       PACKAGE VERSION
160    
161       or
162    
163       COMMAND_NAME (PACKAGE) VERSION.
164    
165       The author names are passed as separate arguments, with an additional
166       NULL argument at the end.  */
167    void
168    version_etc (FILE *stream,
169                 const char *command_name, const char *package,
170                 const char *version, /* const char *author1, ...*/ ...)
171    {
172      va_list authors;
173    
174      va_start (authors, version);
175      version_etc_va (stream, command_name, package, version, authors);
176    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26