Testsuite: OpenSSL version output variances
[exim.git] / src / src / version.c
CommitLineData
059ec3d9
PH
1/*************************************************
2* Exim - an Internet mail transport agent *
3*************************************************/
4
0a49a7a4 5/* Copyright (c) University of Cambridge 1995 - 2009 */
059ec3d9
PH
6/* See the file NOTICE for conditions of use and distribution. */
7
8/* Function for setting up the version string. */
9
10#include "exim.h"
11
6545de78 12#include "version.h"
059ec3d9
PH
13
14
15/* The header file cnumber.h contains a single line containing the
16compilation number, making it easy to have it updated automatically.
17Hence the fudgery below to get the number turned into a string, since
18we can't use #include inside a macro argument list */
19
20void
21version_init(void)
22{
23static uschar cnumber_buffer[24];
24static uschar date_buffer[32];
25
26uschar today[20];
27uschar *version_cnumber_format;
28
29int cnumber =
30#include "cnumber.h"
31;
32
33/* The odd magic after each of these is so they can be easily found
34for automatic patching to standard values when running regression tests.
35The reason that version_cnumber_format isn't just written inline in the
36sprintf() call is the gcc -Wall warns about a \0 in a format string. */
37
38version_cnumber = cnumber_buffer;
39version_cnumber_format = US"%d\0<<eximcnumber>>";
40sprintf(CS version_cnumber, CS version_cnumber_format, cnumber);
6545de78 41version_string = US EXIM_VERSION_STR "\0<<eximversion>>";
059ec3d9 42
6e411084
PP
43#ifdef EXIM_BUILD_DATE_OVERRIDE
44/* Reproducible build support; build tooling should have given us something looking like
45 * "25-Feb-2017 20:15:40" in EXIM_BUILD_DATE_OVERRIDE based on $SOURCE_DATE_EPOCH in environ
46 * per <https://reproducible-builds.org/specs/source-date-epoch/>
47 */
48version_date = date_buffer;
49version_date[0] = 0;
50Ustrncat(version_date, EXIM_BUILD_DATE_OVERRIDE, sizeof(date_buffer));
51
52#else
059ec3d9
PH
53Ustrcpy(today, __DATE__);
54if (today[4] == ' ') today[4] = '0';
55today[3] = today[6] = '-';
56
57version_date = date_buffer;
58version_date[0] = 0;
59Ustrncat(version_date, today+4, 3);
60Ustrncat(version_date, today, 4);
61Ustrncat(version_date, today+7, 4);
62Ustrcat(version_date, " ");
63Ustrcat(version_date, __TIME__);
6e411084 64#endif
059ec3d9
PH
65}
66
67/* End of version.c */