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