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