=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/plugin/oxmisc.c,v retrieving revision 1.22 retrieving revision 1.28 diff -u -p -r1.22 -r1.28 --- OpenXM/src/kan96xx/plugin/oxmisc.c 2004/09/17 07:27:28 1.22 +++ OpenXM/src/kan96xx/plugin/oxmisc.c 2015/09/27 08:12:42 1.28 @@ -1,5 +1,6 @@ -/* $OpenXM: OpenXM/src/kan96xx/plugin/oxmisc.c,v 1.21 2004/09/16 23:53:45 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/plugin/oxmisc.c,v 1.27 2013/11/06 06:23:24 takayama Exp $ */ #include +#include #include #include #include @@ -23,6 +24,11 @@ FILE *MyErrorOut = NULL; #include "ox_kan.h" +#if defined(__MSYS__) +#define setjmp(e) _setjmp(e) +#define sigsetjmp(e,n) _setjmp(e) +#endif + #define READBUFSIZE 5000 int OxVersion = 200012030; @@ -178,6 +184,9 @@ int oxWaitSyncBall(ox_stream ostream) fprintf(stderr,"Looking for the next message tag. mtag=%d\n",mtag); /* or stdout */ fflush(NULL); + if (mtag == -1) { + fprintf(stderr,"Your peer seems to be dead.\n"); return 0; + } } } @@ -344,7 +353,7 @@ void oxSendResultOfControl(int fd) void oxSendMathCap(ox_stream os,struct mathCap *mathcap) { int i,n,infosize,ncmo; - struct object mathinfo; + struct object mathinfo = OINIT; /* printf("ox sending mathcap\n"); fflush(stdout); */ mathinfo = *((struct object *)(mathcap->infop)); infosize = getoaSize(mathinfo); @@ -618,7 +627,8 @@ int oxIsThereErrorClient(oxclientp client) { return(0); } -oxclientp oxCreateClient(char *sname,int portStream,int portControl) +oxclientp oxCreateClient(char *sname,int portStream,int portControl, + char *passControl, char *passData) /* you also need to change oxCreateClient2. */ { int v = 0; @@ -640,6 +650,23 @@ oxclientp oxCreateClient(char *sname,int portStream,in if (fdStream == -1 || fdControl == -1) { fprintf(stderr,"\nOpen error in oxCreateClient.\n"); return(NULL); + } + + if (passControl != NULL) { + if (v) fprintf(stderr,"Sending password %s for the control channel.\n", + passControl); + if (write(fdControl,passControl,strlen(passControl)+1) < 0) { + fprintf(stderr,"oxCreateClient(): failed to send passControl.\n"); + return(NULL); + } + } + if (passData != NULL) { + if (v) fprintf(stderr,"Sending password %s for the data channel.\n", + passData); + if (write(fdStream,passData,strlen(passData)+1) < 0) { + fprintf(stderr,"oxCreateClient(): failed to send passData.\n"); + return(NULL); + } } controlByteOrder = oxSetByteOrder(fdControl);