Debian Codegraph @

Docs/src/bin/halibut/version.c

raw
1 /*
2 * version.c: version string
3 */
4
5 #include <stdio.h>
6 #include <ctype.h>
7 #include <string.h>
8
9 #ifndef VERSION
10 #define VER "anonymous build (" __DATE__ " " __TIME__ ")"
11 #else
12 #define VER "version " VERSION
13 #endif
14
15 #define VERSTRFMT "v1.0 (NSIS Custom Build, %s)"
16 #define VERSTRSCMREVMAX 20
17
18 static char versionbuf[sizeof(VERSTRFMT)-2+VERSTRSCMREVMAX];
19 const char *const version = versionbuf;
20
21 void initversionstring(void)
22 {
23 char scmverbuf[VERSTRSCMREVMAX+1];
24 int cchsvnrev = 0;
25 /* SCM trigger 20211223 */
26 const char*svnproprev = "$Revision: 7347 $";
27 if ('$' == *svnproprev++)
28 {
29 const char*p;
30 while('$' != *svnproprev && !isdigit(*svnproprev)) svnproprev++;
31 for (p = svnproprev; isdigit(*p); ++p) cchsvnrev++;
32 }
33 if (!cchsvnrev)
34 {
35 cchsvnrev = 1;
36 svnproprev = "?";
37 }
38
39 strcpy(scmverbuf, "SVN:r");
40 strncat(scmverbuf, svnproprev, cchsvnrev);
41 sprintf(versionbuf,VERSTRFMT,scmverbuf);
42 }
43