From fb6aa032cf84f543234534cd2c24102eb730bbc4 Mon Sep 17 00:00:00 2001 From: fcolin Date: Tue, 26 Jul 2005 08:47:24 +0000 Subject: compile sur Windows les fichiers getopt sont necessaires uniquement sur Windows( WIN32 ) compilateur VStudio --- src/ivyprobe.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'src/ivyprobe.c') diff --git a/src/ivyprobe.c b/src/ivyprobe.c index 1da9ebc..8143706 100644 --- a/src/ivyprobe.c +++ b/src/ivyprobe.c @@ -37,22 +37,21 @@ #ifdef __MINGW32__ #include #include -#endif -#else +#endif // __MINGW32__ +#else // WIN32 #include #include #ifdef __INTERIX extern char *optarg; extern int optind; -#endif -#ifndef USE_PCRE_REGEX -#include -#else +#endif // __INTERIX +#endif // WIN32 + +#ifdef USE_PCRE_REGEX #define OVECSIZE 60 /* must be multiple of 3, for regexp return */ #include -#endif - - +#else +#include #endif #include "ivychannel.h" @@ -70,10 +69,10 @@ int app_count = 0; int wait_count = 0; int fbindcallback = 0; -void DirectCallback(IvyClientPtr app, void *user_data, int id, char *msg ) +void DirectCallback(IvyClientPtr app, void *user_data, int id, int len, void *msg ) { printf("%s sent a direct message, id=%d, message=%s\n", - IvyGetApplicationName(app),id,msg); + IvyGetApplicationName(app),id,(char*)msg); } void BindCallback(IvyClientPtr app, void *user_data, IvyBindEvent event, char *regexp ) @@ -109,6 +108,7 @@ void HandleStdin (Channel channel, HANDLE fd, void *data) char *line; char *cmd; char *arg; + char *choparg; int id; IvyClientPtr app; int err; @@ -145,7 +145,15 @@ void HandleStdin (Channel channel, HANDLE fd, void *data) } else if (strcmp(cmd, "bind") == 0) { arg = strtok (NULL, "'"); if (arg) { -#ifndef USE_PCRE_REGEX +#ifdef USE_PCRE_REGEX + pcre *regexp; + const char *errbuf; + int erroffset; + Chop(arg); + regexp = pcre_compile(arg, 0,&errbuf,&erroffset,NULL); + if (regexp==NULL) { + printf("Error compiling '%s', %s, not bound\n", arg, errbuf); +#else regex_t reg; int err; Chop(arg); @@ -153,14 +161,7 @@ void HandleStdin (Channel channel, HANDLE fd, void *data) char errbuf[4096]; regerror (err, ®, errbuf, 4096); printf("Error compiling '%s', %s, not bound\n", arg, errbuf); -#else - pcre *regexp; - const char *errbuf; - int erroffset; - Chop(arg); - regexp = pcre_compile(arg, 0,&errbuf,&erroffset,NULL); - if (regexp==NULL) { - printf("Error compiling '%s', %s, not bound\n", arg, errbuf); + #endif } else { IvyBindMsg (Callback, NULL, Chop(arg)); @@ -178,12 +179,13 @@ void HandleStdin (Channel channel, HANDLE fd, void *data) } else if (strcmp(cmd, "direct") == 0) { arg = strtok (NULL, " \n"); if (arg) { + choparg = Chop(arg); app = IvyGetApplication (arg); if (app) { arg = strtok (NULL, " "); id = atoi (arg) ; arg = strtok (NULL, "'"); - IvySendDirectMsg (app, id, Chop(arg)); + IvySendDirectMsg (app, id, strlen(choparg), choparg); } else printf ("No Application %s!!!\n",arg); } -- cgit v1.1