| 1 | /************************************************* |
| 2 | * Exim - an Internet mail transport agent * |
| 3 | *************************************************/ |
| 4 | |
| 5 | /* Copyright (c) University of Cambridge 1995 - 2009 */ |
| 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 | |
| 12 | #include "version.h" |
| 13 | |
| 14 | |
| 15 | /* The header file cnumber.h contains a single line containing the |
| 16 | compilation number, making it easy to have it updated automatically. |
| 17 | Hence the fudgery below to get the number turned into a string, since |
| 18 | we can't use #include inside a macro argument list */ |
| 19 | |
| 20 | void |
| 21 | version_init(void) |
| 22 | { |
| 23 | static uschar cnumber_buffer[24]; |
| 24 | static uschar date_buffer[32]; |
| 25 | |
| 26 | uschar today[20]; |
| 27 | uschar *version_cnumber_format; |
| 28 | |
| 29 | int cnumber = |
| 30 | #include "cnumber.h" |
| 31 | ; |
| 32 | |
| 33 | /* The odd magic after each of these is so they can be easily found |
| 34 | for automatic patching to standard values when running regression tests. |
| 35 | The reason that version_cnumber_format isn't just written inline in the |
| 36 | sprintf() call is the gcc -Wall warns about a \0 in a format string. */ |
| 37 | |
| 38 | version_cnumber = cnumber_buffer; |
| 39 | version_cnumber_format = US"%d\0<<eximcnumber>>"; |
| 40 | sprintf(CS version_cnumber, CS version_cnumber_format, cnumber); |
| 41 | version_string = US EXIM_VERSION_STR "\0<<eximversion>>"; |
| 42 | |
| 43 | Ustrcpy(today, __DATE__); |
| 44 | if (today[4] == ' ') today[4] = '0'; |
| 45 | today[3] = today[6] = '-'; |
| 46 | |
| 47 | version_date = date_buffer; |
| 48 | version_date[0] = 0; |
| 49 | Ustrncat(version_date, today+4, 3); |
| 50 | Ustrncat(version_date, today, 4); |
| 51 | Ustrncat(version_date, today+7, 4); |
| 52 | Ustrcat(version_date, " "); |
| 53 | Ustrcat(version_date, __TIME__); |
| 54 | } |
| 55 | |
| 56 | /* End of version.c */ |