* Doing colored output on windows is fucking stupid. The linux way is
* the real way. So we emulate it on windows :)
*/
-#ifdef _MSC_VER
+#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
WWHITE
};
-static int win_fputs(const char *str, FILE *h) {
+static int win_fputs(FILE *h, const char *str) {
/* state for translate */
int acolor;
int wcolor;
state = -1;
}
} else {
- file_putc(*str, h);
+ file_putc(h, *str);
length ++;
}
str++;
*/
static int con_write(FILE *handle, const char *fmt, va_list va) {
int ln;
- #ifndef _MSC_VER
+ #ifndef _WIN32
ln = vfprintf(handle, fmt, va);
#else
{
return fseek(fp, off, whence);
}
+int file_putc(FILE *fp, int ch) {
+ /* Invokes file_exception on windows if fp is null */
+ return fputc(ch, fp);
+}
+
/*
* Implements libc getline for systems that don't have it, which is
* assmed all. This works the same as getline().
GMQCC_INLINE int file_getc (FILE *);
GMQCC_INLINE int file_printf (FILE *, const char *, ...);
GMQCC_INLINE int file_puts (FILE *, const char *);
+GMQCC_INLINE int file_putc (FILE *, int);
GMQCC_INLINE int file_seek (FILE *, long int, int);
GMQCC_INLINE size_t file_read (void *, size_t, size_t, FILE *);
# define popen _popen
# define pclose _pclose
# include <windows.h>
-# include <io.h>
+# include <io.h>
# include <fcntl.h>
/*
* Bidirectional piping implementation for windows using CreatePipe and DuplicateHandle +
# ifdef __MINGW32__
/* mingw32 has dirent.h */
# include <dirent.h>
-# elif defined (_MSC_VER)
+# elif defined (_WIN32)
/*
* visual studio lacks dirent.h it's a posix thing
* so we emulate it with the WinAPI.