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