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