8228f946791b4eb17b953471915350594c2e7c7b
[exim.git] / src / exim_monitor / em_version.c
1 /*************************************************
2 * Exim Monitor *
3 *************************************************/
4
5 /* Copyright (c) University of Cambridge 1995 - 2017 */
6 /* See the file NOTICE for conditions of use and distribution. */
7
8 #include "mytypes.h"
9 #include "macros.h"
10 #include <string.h>
11 #include <stdlib.h>
12
13 #include "version.h"
14
15 extern uschar *version_string;
16 extern uschar *version_date;
17
18 void
19 version_init(void)
20 {
21 int i = 0;
22 uschar today[20];
23
24 version_string = US"2.06";
25
26 #ifdef EXIM_BUILD_DATE_OVERRIDE
27 /* Reproducible build support; build tooling should have given us something looking like
28 * "25-Feb-2017 20:15:40" in EXIM_BUILD_DATE_OVERRIDE based on $SOURCE_DATE_EPOCH in environ
29 * per <https://reproducible-builds.org/specs/source-date-epoch/>
30 */
31 version_date = US malloc(32);
32 version_date[0] = 0;
33 Ustrncat(version_date, EXIM_BUILD_DATE_OVERRIDE, 31);
34
35 #else
36 Ustrcpy(today, __DATE__);
37 if (today[4] == ' ') i = 1;
38 today[3] = today[6] = '-';
39
40 version_date = US malloc(32);
41 version_date[0] = 0;
42 Ustrncat(version_date, today+4+i, 3-i);
43 Ustrncat(version_date, today, 4);
44 Ustrncat(version_date, today+7, 4);
45 Ustrcat(version_date, " ");
46 Ustrcat(version_date, __TIME__);
47 #endif
48 }
49
50 /* End of em_version.c */