diff options
Diffstat (limited to 'tools/ivytestready.c')
-rwxr-xr-x | tools/ivytestready.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/tools/ivytestready.c b/tools/ivytestready.c index 46fe1de..976754d 100755 --- a/tools/ivytestready.c +++ b/tools/ivytestready.c @@ -23,7 +23,7 @@ #include <getopt.h> #endif #else -#include <sys/time.h> +#include <time.h> #include <unistd.h> #ifdef __INTERIX extern char *optarg; @@ -32,12 +32,16 @@ extern int optind; #endif -#include "ivysocket.h" #include "ivy.h" #include "timer.h" #include "ivyloop.h" #define MILLISEC 1000.0 +//const char* IVY_ADDR = "127.0.0.255"; +const char* IVY_ADDR = "192.168.1.255"; +//const char* IVY_ADDR = "10.33.39.255"; +const char* IVY_PORT = "2023"; + const char * me = "A"; const char * other = "B"; char ready_message[1000] = "A ready"; @@ -88,22 +92,29 @@ void binCB( IvyClientPtr app, void *user_data, int id, const char* regexp, IvyB - int main(int argc, char *argv[]) { /* Mainloop management */ if ( argc > 1 ) { - me = "B" ; + me = "B"; other = "A"; - strcpy( ready_message, "B ready"); - strcpy( ready_bind, "^A ready"); +#ifdef WIN32 + strcpy_s( ready_message, sizeof(ready_message), "B ready"); + strcpy_s( ready_bind, sizeof(ready_bind), "^A ready"); +#else + strcpy(ready_message, "B ready"); + strcpy(ready_bind, "^A ready"); +#endif } IvyInit (me, ready_message, NULL,NULL,NULL,NULL); IvySetBindCallback( binCB, 0 ); +#ifdef WIN32 + IvyBindMsg(Ready, NULL, ready_bind); +#else #if defined(__GNUC__) && __GNUC_PREREQ(4,7) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-security" @@ -112,12 +123,17 @@ int main(int argc, char *argv[]) #if defined(__GNUC__) && __GNUC_PREREQ(4,7) #pragma GCC diagnostic pop #endif +#endif IvyBindMsg (Question, NULL, "^are you there %s",me); IvyBindMsg (Reply, NULL, "^(yes i am %s)",other); - IvyStart (0); + //IvyStart (NULL); + char domain[30]; + snprintf(domain, sizeof(domain), "%s:%s", IVY_ADDR, IVY_PORT); + + IvyStart (domain); IvyMainLoop (); return 0; |