-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_version.c
More file actions
82 lines (73 loc) · 1.89 KB
/
_version.c
File metadata and controls
82 lines (73 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* showVersion, simple function to display version information
*/
#include <stdio.h>
#include <limits.h>
#include <stdint.h>
#include <stdbool.h>
#include "showVersion.h"
#include "_version.h" // generated by getVersion
#include "appinfo.h" // static version info
// showVersion: _REVISION_
//
// in the unlikely case that APP_PRODUCT and APP_OWNER are not
// defined given them sensible values
#ifndef APP_PRODUCT
#define APP_PRODUCT APP_NAME
#endif
#ifndef APP_OWNER
#define APP_OWNER "Mark Ogden"
#endif
#ifdef _DEBUG
#define BUILD "debug "
#else
#define BUILD
#endif
/* if common libraries are used then define APP_LIBS with a list
* of the version strings exported by the libraries
* these version strings are arrays of char
*/
#ifdef APP_LIBS
extern verstr APP_LIBS;
char const *libvers[] = { APP_LIBS, NULL };
#endif
/// <summary>
/// Shows the version information combining the static information from appinfo.h
/// and the generated version information derived from git in _version.h
/// </summary>
/// <param name="full">if set to <c>true</c>Display extended version info.</param>
/// Common usage is to call from main
/*
* #include "showVersion.h
*
* and in main code
* CHK_SHOW_VERSION(argc, argv);
*
*/
void showVersion(bool full) {
puts(APP_PRODUCT " (C) " APP_OWNER
#ifdef APP_MODS
" <" APP_MODS ">"
#endif
" " GIT_VERSION);
if (full) { // full version info
#ifdef APP_DESCRIPTION
puts(APP_DESCRIPTION);
#endif
#ifdef APP_CONTRIBUTOR
puts("Contributors: " APP_CONTRIBUTOR);
#endif
printf("%d bit " BUILD "build: " __DATE__ " " __TIME__ "\n",
(int)(sizeof(void *) * CHAR_BIT));
#ifdef APP_LIBS
for (char const **p = libvers; *p; p++) {
putchar('+');
putchar(' ');
puts(*p);
}
#endif
#ifdef APP_EMAIL
puts("Support email: " APP_EMAIL);
#endif
}
}