diff options
author | dscho <dscho> | 2004-12-01 23:06:56 +0000 |
---|---|---|
committer | dscho <dscho> | 2004-12-01 23:06:56 +0000 |
commit | 658b65ad0cc2045bf2c930c8ef2a2853a07ba6ee (patch) | |
tree | 51a7b1f153204de2c3bc423411d8f5b2f566c4f6 /client_examples | |
parent | 7d3b1c9762b5f2878e9783677677cb2b3aa10e7e (diff) | |
download | libtdevnc-658b65ad0cc2045bf2c930c8ef2a2853a07ba6ee.tar.gz libtdevnc-658b65ad0cc2045bf2c930c8ef2a2853a07ba6ee.zip |
support MinGW32!
Diffstat (limited to 'client_examples')
-rw-r--r-- | client_examples/Makefile.am | 2 | ||||
-rw-r--r-- | client_examples/SDLvncviewer.c | 46 |
2 files changed, 46 insertions, 2 deletions
diff --git a/client_examples/Makefile.am b/client_examples/Makefile.am index 12ec911..1a6cdc5 100644 --- a/client_examples/Makefile.am +++ b/client_examples/Makefile.am @@ -1,5 +1,5 @@ DEFINES=-I.. -g -Wall -LDADD = ../libvncclient/libvncclient.a +LDADD = ../libvncclient/libvncclient.a @WSOCKLIB@ if WITH_FFMPEG FFMPEG_HOME=@with_ffmpeg@ 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 <SDL/SDL.h> +#include <SDL.h> #include <rfb/rfbclient.h> 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 <stdarg.h> +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); |