]> git.sur5r.net Git - i3/i3/blob - libi3/is_debug_build.c
4e583622b3f78ec1050b1755cf40d2c908dc5faa
[i3/i3] / libi3 / is_debug_build.c
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  */
8 #include "libi3.h"
9
10 #include <string.h>
11 #include <stdbool.h>
12
13 /*
14  * Returns true if this version of i3 is a debug build (anything which is not a
15  * release version), based on the git version number.
16  *
17  */
18 bool is_debug_build() {
19     /* i3_version contains either something like this:
20      *     "4.0.2 (2011-11-11, branch "release")".
21      * or: "4.0.2-123-gCOFFEEBABE (2011-11-11, branch "next")".
22      *
23      * So we check for the offset of the first opening round bracket to
24      * determine whether this is a git version or a release version. */
25     return ((strchr(I3_VERSION, '(') - I3_VERSION) > 10);
26 }