Freeciv-3.2
Loading...
Searching...
No Matches
version.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* utility */
19#include "fcintl.h"
20#include "shared.h"
21#include "support.h"
22
23/* common */
24#include "fc_types.h"
25
26#include "version.h"
27
28#ifdef GITREV
29#include "fc_gitrev_gen.h"
30#endif /* GITREV */
31
32/*******************************************************************/
35const char *freeciv_name_version(void)
36{
37 static char msgbuf[256];
38
39#if IS_BETA_VERSION
40#if defined(GITREV) && !defined(FC_GITREV_OFF)
41 fc_snprintf(msgbuf, sizeof (msgbuf), _("Freeciv version %s %s (%s)"),
42 VERSION_STRING, _("(beta version)"),
44#else
45 fc_snprintf(msgbuf, sizeof (msgbuf), _("Freeciv version %s %s"),
46 VERSION_STRING, _("(beta version)"));
47#endif
48#elif defined(GITREV) && !defined(FC_GITREV_OFF)
49 fc_snprintf(msgbuf, sizeof (msgbuf), _("Freeciv version %s (%s)"),
51#else
52 fc_snprintf(msgbuf, sizeof (msgbuf), _("Freeciv version %s"),
54#endif
55
56 return msgbuf;
57}
58
59/*******************************************************************/
62const char *word_version(void)
63{
64#if IS_BETA_VERSION
65 return _("betatest version ");
66#else
67 return _("version ");
68#endif
69}
70
71/*******************************************************************/
75const char *fc_git_revision(void)
76{
77#if defined(GITREV) && !defined(FC_GITREV_OFF)
78 static char buf[100];
79 bool translate = FC_GITREV1[0] != '\0';
80
81 fc_snprintf(buf, sizeof(buf), "%s%s",
83
84 return buf; /* Either revision, or modified revision */
85#else /* FC_GITREV_OFF */
86 return NULL;
87#endif /* FC_GITREV_OFF */
88}
89
90/*******************************************************************/
95const char *fc_comparable_version(void)
96{
97 return VERSION_STRING;
98}
99
100/*******************************************************************/
104const char *beta_message(void)
105{
106#if IS_BETA_VERSION
107 static char msgbuf[500];
108 static const char *month[] =
109 {
110 NULL,
111 N_("January"),
112 N_("February"),
113 N_("March"),
114 N_("April"),
115 N_("May"),
116 N_("June"),
117 N_("July"),
118 N_("August"),
119 N_("September"),
120 N_("October"),
121 N_("November"),
122 N_("December")
123 };
124
125 if (FREECIV_RELEASE_MONTH > 0) {
126 fc_snprintf(msgbuf, sizeof(msgbuf),
127 /* TRANS: No full stop after the URL, could cause confusion. */
128 _("THIS IS A BETA VERSION\n"
129 "Freeciv %s will be released in %s, at %s"),
131 } else {
132 fc_snprintf(msgbuf, sizeof(msgbuf),
133 _("THIS IS A BETA VERSION\n"
134 "Freeciv %s will be released at %s"),
136 }
137 return msgbuf;
138#else /* IS_BETA_VERSION */
139 return NULL;
140#endif /* IS_BETA_VERSION */
141}
142
143/*******************************************************************/
147const char *alpha_message(void)
148{
149#if IS_DEVEL_VERSION
150 return _("THIS IS A DEVELOPMENT VERSION");
151#else /* IS_DEVEL_VERSION */
152 return NULL;
153#endif /* IS_DEVEL_VERSION */
154}
155
156/*******************************************************************/
160const char *unstable_message(void)
161{
162#if IS_DEVEL_VERSION
163 return alpha_message();
164#elif IS_BETA_VERSION
165 return beta_message();
166#else
167 return NULL;
168#endif
169}
170
171/*******************************************************************/
177const char *freeciv_motto(void)
178{
179 return _("'Cause civilization should be free!");
180}
181
182/*******************************************************************/
187{
188 static char buf[500] = { '\0' };
189
190 if (buf[0] == '\0') {
191 const char *ver_rev;
192
194 if (ver_rev != NULL) {
195 fc_snprintf(buf, sizeof(buf), "%s (%s)", VERSION_STRING, ver_rev);
196 } else {
197 fc_snprintf(buf, sizeof(buf), "%s", VERSION_STRING);
198 }
199 }
200
201 return buf;
202}
char * incite_cost
Definition comments.c:75
#define _(String)
Definition fcintl.h:67
#define N_(String)
Definition fcintl.h:69
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:974
const char * fc_comparable_version(void)
Definition version.c:95
const char * fc_git_revision(void)
Definition version.c:75
const char * unstable_message(void)
Definition version.c:160
const char * freeciv_name_version(void)
Definition version.c:35
const char * freeciv_datafile_version(void)
Definition version.c:186
const char * beta_message(void)
Definition version.c:104
const char * freeciv_motto(void)
Definition version.c:177
const char * word_version(void)
Definition version.c:62
const char * alpha_message(void)
Definition version.c:147
#define NEXT_RELEASE_MONTH
Definition version.h:28