1 /*
2  * madplay - MPEG audio decoder and player
3  * Copyright (C) 2000-2004 Robert Leslie
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  * $Id: version.c,v 1.18 2004/01/23 09:41:32 rob Exp $
20  */
21 
22 # ifdef HAVE_CONFIG_H
23 #  include "config.h"
24 # endif
25 
26 # include "global.h"
27 
28 # include <stdio.h>
29 # include <string.h>
30 # include <mad.h>
31 # include <id3tag.h>
32 
33 # include "gettext.h"
34 
35 # include "version.h"
36 
37 # define STRINGIZE(str)	#str
38 # define STRING(str)	STRINGIZE(str)
39 
40 # define COPYRIGHT	"Copyright (C)"
41 
42 char const madplay_version[]   = "madplay " MADPLAY_VERSION;
43 char const madplay_copyright[] = COPYRIGHT " " MADPLAY_PUBLISHYEAR
44                                  " " MADPLAY_AUTHOR;
45 char const madplay_author[]    = MADPLAY_AUTHOR " <" MADPLAY_EMAIL ">";
46 
47 char const madplay_build[] = ""
48 # if defined(DEBUG)
49   "DEBUG "
50 # elif defined(NDEBUG)
51   "NDEBUG "
52 # endif
53 
54 # if defined(EXPERIMENTAL)
55   "EXPERIMENTAL "
56 # endif
57 
58   "AUDIO_DEFAULT=" STRING(AUDIO_DEFAULT) " "
59 
60 # if defined(ENABLE_NLS)
61   "ENABLE_NLS "
62 # endif
63 ;
64 
ver_banner(FILE * stream)65 void ver_banner(FILE *stream)
66 {
67   fprintf(stream, "%s %s - %s %s %s et al.\n", _("MPEG Audio Decoder"),
68 	  MADPLAY_VERSION,
69 	  _("Copyright (C)"), MADPLAY_PUBLISHYEAR, MADPLAY_AUTHOR);
70 
71   fflush(stream);
72 }
73 
copyright(FILE * stream,char const * str)74 void copyright(FILE *stream, char const *str)
75 {
76   if (strstr(str, COPYRIGHT) == str)
77     fprintf(stream, "  %s%s\n", _(COPYRIGHT), &str[sizeof(COPYRIGHT) - 1]);
78   else
79     fprintf(stream, "  %s\n", str);
80 }
81 
ver_version(FILE * stream)82 void ver_version(FILE *stream)
83 {
84   fprintf(stream, "%s\n", mad_version);
85   copyright(stream, mad_copyright);
86   fprintf(stream, "  %s: %s\n\n", _("Build options"), mad_build);
87 
88   fprintf(stream, "%s\n", id3_version);
89   copyright(stream, id3_copyright);
90   fprintf(stream, "  %s: %s\n\n", _("Build options"), id3_build);
91 
92   fprintf(stream, "%s\n", madplay_version);
93   copyright(stream, madplay_copyright);
94   fprintf(stream, "  %s: %s\n\n", _("Build options"), madplay_build);
95 }
96 
ver_license(FILE * stream)97 void ver_license(FILE *stream)
98 {
99   fputc('\n', stream);
100   fprintf(stream,
101   _("This program is free software; you can redistribute it and/or modify it\n"
102     "under the terms of the GNU General Public License as published by the\n"
103     "Free Software Foundation; either version 2 of the License, or (at your\n"
104     "option) any later version.\n\n"
105 
106     "This program is distributed in the hope that it will be useful, but\n"
107     "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
108     "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n"
109     "General Public License for more details.\n\n"
110 
111     "You should have received a copy of the GNU General Public License along\n"
112     "with this program; if not, write to the Free Software Foundation, Inc.,\n"
113     "59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n\n"
114 
115     "Some portions of this program may be licensable under different terms.\n"
116     "To inquire about alternate licensing, contact: %s\n"), madplay_author);
117 
118   fputc('\n', stream);
119 }
120