oga's tools
Revision | 7ba6498104d8be2430baad87c7be09bedad04643 (tree) |
---|---|
Zeit | 2014-02-22 01:28:16 |
Autor | oga <hyperoga@gmai...> |
Commiter | oga |
2014/02/22 V1.03 support MinGW
@@ -4,14 +4,15 @@ | ||
4 | 4 | // 2001/10/17 V1.00 by oga. |
5 | 5 | // 2007/04/19 V1.01 support suspend |
6 | 6 | // 2009/12/17 V1.02 fix ExitWindowsEx() error log |
7 | +// 2014/02/22 V1.03 support MinGW | |
7 | 8 | // |
8 | 9 | #include <windows.h> |
9 | 10 | #include <stdio.h> |
10 | 11 | #include <powrprof.h> |
11 | 12 | |
12 | 13 | // globals |
13 | -char *VER = "1.02"; | |
14 | -int logf = 0; // -log option | |
14 | +char *VER = "1.03"; | |
15 | +int logff = 0; // -log option | |
15 | 16 | char *logfile = NULL; // log file name |
16 | 17 | FILE *fp = NULL; |
17 | 18 |
@@ -36,11 +37,11 @@ void usage() | ||
36 | 37 | int outlog(char *msg) |
37 | 38 | { |
38 | 39 | SYSTEMTIME syst; |
39 | - if (logf) { | |
40 | + if (logff) { | |
40 | 41 | if (fp == NULL) { |
41 | 42 | if ((fp = fopen(logfile, "a")) == NULL) { |
42 | 43 | perror("Error: fopen()"); |
43 | - logf = 0; | |
44 | + logff = 0; | |
44 | 45 | } |
45 | 46 | } |
46 | 47 | GetLocalTime(&syst); |
@@ -170,7 +171,7 @@ int main(int a, char *b[]) | ||
170 | 171 | /* V1.01-A end */ |
171 | 172 | if (!strcmp(b[i], "-log")) { |
172 | 173 | if (++i < a) { |
173 | - logf = 1; | |
174 | + logff = 1; | |
174 | 175 | logfile = b[i]; |
175 | 176 | continue; |
176 | 177 | } else { |
@@ -288,7 +289,7 @@ int main(int a, char *b[]) | ||
288 | 289 | } |
289 | 290 | |
290 | 291 | if (fp) fclose(fp); // close logfile |
291 | - logf = 0; | |
292 | + logff = 0; | |
292 | 293 | if (!ExitWindowsEx(shutopt, 0)) { |
293 | 294 | char *msgbuf; |
294 | 295 | FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | |