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