summaryrefslogtreecommitdiffstats
path: root/src/termcolors.c
diff options
context:
space:
mode:
authorGravatar Duncan Ogilvie2024-11-26 18:27:20 +0100
committerGravatar Duncan Ogilvie2024-11-26 18:27:20 +0100
commit2373fca9f98a718f3fb9d3cc0c109c21acf8ecf2 (patch)
tree340c964047ca5b2502f3f65dd650516c4a257356 /src/termcolors.c
parent5140e4f2b9f85292954ada4662ac351935a179a4 (diff)
downloadlibimobiledevice-glue-2373fca9f98a718f3fb9d3cc0c109c21acf8ecf2.tar.gz
libimobiledevice-glue-2373fca9f98a718f3fb9d3cc0c109c21acf8ecf2.tar.bz2
Change WIN32 to _WIN32 to check if running on Windows
Diffstat (limited to 'src/termcolors.c')
-rw-r--r--src/termcolors.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/termcolors.c b/src/termcolors.c
index 5c436f2..798e47a 100644
--- a/src/termcolors.c
+++ b/src/termcolors.c
@@ -22,7 +22,7 @@
#include "config.h"
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#endif
@@ -37,7 +37,7 @@
static int use_colors = 0;
-#ifdef WIN32
+#ifdef _WIN32
static int WIN32_LEGACY_MODE = 1;
static WORD COLOR_RESET_ATTR = 0;
static WORD DEFAULT_FG_ATTR = 0;
@@ -94,7 +94,7 @@ static int WIN32_LEGACY_MODE = 0;
void term_colors_init()
{
-#ifdef WIN32
+#ifdef _WIN32
DWORD conmode = 0;
h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleMode(h_stdout, &conmode);
@@ -135,7 +135,7 @@ int cvfprintf(FILE* stream, const char* fmt, va_list vargs)
{
int res = 0;
int colorize = use_colors;
-#ifdef WIN32
+#ifdef _WIN32
struct esc_item {
int pos;
WORD attr;
@@ -162,7 +162,7 @@ int cvfprintf(FILE* stream, const char* fmt, va_list vargs)
va_end(vargs_copy);
// then, we need to remove the escape sequences, if any
-#ifdef WIN32
+#ifdef _WIN32
// if colorize is on, we need to keep their positions for later
struct esc_item* esc_items = NULL;
int attr = 0;
@@ -183,7 +183,7 @@ int cvfprintf(FILE* stream, const char* fmt, va_list vargs)
if (*p == '\e' && end-p > 2 && *(p+1) == '[') {
p+=2;
if (*p == 'm') {
-#ifdef WIN32
+#ifdef _WIN32
attr = COLOR_RESET_ATTR;
#endif
int move_by = (p+1)-cur;
@@ -197,13 +197,13 @@ int cvfprintf(FILE* stream, const char* fmt, va_list vargs)
long lval = strtol(p, &endp, 10);
if (!endp || (*endp != ';' && *endp != 'm')) {
fprintf(stderr, "\n*** %s: Invalid escape sequence in format string, expected ';' or 'm' ***\n", __func__);
-#ifdef WIN32
+#ifdef _WIN32
free(esc_items);
#endif
free(newbuf);
return -1;
}
-#ifdef WIN32
+#ifdef _WIN32
if (colorize) {
if (lval >= 0 && lval <= 8) {
/* style attributes */
@@ -249,7 +249,7 @@ int cvfprintf(FILE* stream, const char* fmt, va_list vargs)
end -= move_by;
p = cur;
}
-#ifdef WIN32
+#ifdef _WIN32
if (colorize) {
esc_items[num_esc].pos = p-start;
if (attr & STYLE_DIM) {
@@ -268,12 +268,12 @@ int cvfprintf(FILE* stream, const char* fmt, va_list vargs)
if (num_esc == 0) {
res = fputs(newbuf, stream);
free(newbuf);
-#ifdef WIN32
+#ifdef _WIN32
free(esc_items);
#endif
return res;
}
-#ifdef WIN32
+#ifdef _WIN32
else {
p = &newbuf[0];
char* lastp = &newbuf[0];