Mon, 28 Apr 2014 18:02:43 +0300
- some minor cleanup
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* updaterevision.c |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Public domain. This program uses git commands command to get |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * various bits of repository status for a particular directory |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * and writes it into a header file so that it can be used for a |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * project's versioning. |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | */ |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | #define _CRT_SECURE_NO_DEPRECATE |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | #include <stdio.h> |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | #include <stdlib.h> |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | #include <string.h> |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | #include <ctype.h> |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | #include <errno.h> |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
16 | #include <time.h> |
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | #ifdef _WIN32 |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #define popen _popen |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #define pclose _pclose |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #endif |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | // Used to strip newline characters from lines read by fgets. |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | void stripnl(char *str) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | if (*str != '\0') |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | size_t len = strlen(str); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | if (str[len - 1] == '\n') |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | str[len - 1] = '\0'; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | int main(int argc, char **argv) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | { |
659
06c4477675e4
- doubled buffer sizes in updaterevision to prevent GIT_HASH from being truncated
Santeri Piippo <crimsondusk64@gmail.com>
parents:
632
diff
changeset
|
38 | char vertag[128], lastlog[128], lasthash[128], *hash = NULL; |
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | FILE *stream = NULL; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | int gotrev = 0, needupdate = 1; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
42 | // [SP] Stuff for build time. |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
43 | time_t now; |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
44 | char currentTime[128]; |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
45 | char* cp; |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
46 | |
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | vertag[0] = '\0'; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | lastlog[0] = '\0'; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | if (argc != 2) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | fprintf(stderr, "Usage: %s <path to gitinfo.h>\n", argv[0]); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | return 1; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | // Use git describe --tags to get a version string. If we are sitting directly |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | // on a tag, it returns that tag. Otherwise it returns <most recent tag>-<number of |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | // commits since the tag>-<short hash>. |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | // Use git log to get the time of the latest commit in ISO 8601 format and its full hash. |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | stream = popen("git describe --tags && git log -1 --format=%ai*%H", "r"); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | if (NULL != stream) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | if (fgets(vertag, sizeof vertag, stream) == vertag && |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | fgets(lastlog, sizeof lastlog, stream) == lastlog) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | stripnl(vertag); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | stripnl(lastlog); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | gotrev = 1; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | pclose(stream); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | if (gotrev) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | hash = strchr(lastlog, '*'); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | if (hash != NULL) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | *hash = '\0'; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | hash++; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | if (hash == NULL) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | fprintf(stderr, "Failed to get commit info: %s\n", strerror(errno)); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | strcpy(vertag, "<unknown version>"); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | lastlog[0] = '\0'; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | lastlog[1] = '0'; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | lastlog[2] = '\0'; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | hash = lastlog + 1; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | stream = fopen (argv[1], "r"); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | if (stream != NULL) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | if (!gotrev) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | { // If we didn't get a revision but the file does exist, leave it alone. |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | fclose (stream); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | return 0; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | // Read the revision that's in this file already. If it's the same as |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | // what we've got, then we don't need to modify it and can avoid rebuilding |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | // dependant files. |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
105 | // [SP] I'm including build date in the file now so it must always be rebuilt. |
748
8d4a9d03e246
- some minor cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents:
745
diff
changeset
|
106 | // In LDForge, this is only used by the very-quick-to-build version.cc anyway. |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
107 | #if 0 |
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | if (fgets(lasthash, sizeof lasthash, stream) == lasthash) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | stripnl(lasthash); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | if (strcmp(hash, lasthash + 3) == 0) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | needupdate = 0; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | } |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
116 | #endif |
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | fclose (stream); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
120 | // [SP] Current time. |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
121 | now = time (NULL); |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
122 | strftime (currentTime, sizeof currentTime, "%F %T %z", localtime (&now)); |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
123 | |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
124 | // [SP] For some dumb reason asctime includes a newline character. Get rid of it. |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
125 | for (cp = ¤tTime[0]; *cp != '\0'; ++cp) |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
126 | { |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
127 | if (*cp == '\n') |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
128 | { |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
129 | *cp = '\0'; |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
130 | break; |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
131 | } |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
132 | } |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
133 | |
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | if (needupdate) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | stream = fopen (argv[1], "w"); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | if (stream == NULL) |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | return 1; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | fprintf(stream, |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | "// %s\n" |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | "//\n" |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | "// This file was automatically generated by the\n" |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | "// updaterevision tool. Do not edit by hand.\n" |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | "\n" |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | "#define GIT_DESCRIPTION \"%s\"\n" |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | "#define GIT_HASH \"%s\"\n" |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
149 | "#define GIT_TIME \"%s\"\n" |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
150 | "#define BUILD_TIME \"%s\"\n", |
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
151 | hash, vertag, hash, lastlog, currentTime); |
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
152 | fclose(stream); |
745
ab8adddc0f5c
- added build time to window title properly
Santeri Piippo <crimsondusk64@gmail.com>
parents:
659
diff
changeset
|
153 | fprintf(stderr, "%s updated to commit %s (build time: %s).\n", argv[1], vertag, currentTime); |
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
155 | else |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | { |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
157 | fprintf (stderr, "%s is up to date at commit %s.\n", argv[1], vertag); |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | } |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
160 | return 0; |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | } |