From 658b65ad0cc2045bf2c930c8ef2a2853a07ba6ee Mon Sep 17 00:00:00 2001 From: dscho Date: Wed, 1 Dec 2004 23:06:56 +0000 Subject: support MinGW32! --- client_examples/SDLvncviewer.c | 46 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'client_examples/SDLvncviewer.c') diff --git a/client_examples/SDLvncviewer.c b/client_examples/SDLvncviewer.c index 401c42f..9bfb1c9 100644 --- a/client_examples/SDLvncviewer.c +++ b/client_examples/SDLvncviewer.c @@ -1,4 +1,4 @@ -#include +#include #include static rfbBool resize(rfbClient* client) { @@ -186,6 +186,46 @@ void update(rfbClient* cl,int x,int y,int w,int h) { SDL_UpdateRect(cl->clientData, x, y, w, h); } +#ifdef __MINGW32__ +#define LOG_TO_FILE +#endif + +#ifdef LOG_TO_FILE +#include +static void +log_to_file(const char *format, ...) +{ + FILE* logfile; + static char* logfile_str=0; + va_list args; + char buf[256]; + time_t log_clock; + + if(!rfbEnableClientLogging) + return; + + if(logfile_str==0) { + logfile_str=getenv("VNCLOG"); + if(logfile_str==0) + logfile_str="vnc.log"; + } + + logfile=fopen(logfile_str,"a"); + + va_start(args, format); + + time(&log_clock); + strftime(buf, 255, "%d/%m/%Y %X ", localtime(&log_clock)); + fprintf(logfile,buf); + + vfprintf(logfile, format, args); + fflush(logfile); + + va_end(args); + fclose(logfile); +} +#endif + #ifdef mac #define main SDLmain #endif @@ -195,6 +235,10 @@ int main(int argc,char** argv) { int i,buttonMask=0; SDL_Event e; +#ifdef LOG_TO_FILE + rfbClientLog=rfbClientErr=log_to_file; +#endif + SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE); cl=rfbGetClient(5,3,2); -- cgit v1.2.3