=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/plugin/oxmisc.c,v retrieving revision 1.22 retrieving revision 1.26 diff -u -p -r1.22 -r1.26 --- OpenXM/src/kan96xx/plugin/oxmisc.c 2004/09/17 07:27:28 1.22 +++ OpenXM/src/kan96xx/plugin/oxmisc.c 2006/05/06 10:53:36 1.26 @@ -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.25 2005/07/03 11:08:54 ohara Exp $ */ #include +#include #include #include #include @@ -178,6 +179,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; + } } } @@ -344,7 +348,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 +622,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 +645,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);