=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/plugin/mytcpio.c,v retrieving revision 1.13 retrieving revision 1.17 diff -u -p -r1.13 -r1.17 --- OpenXM/src/kan96xx/plugin/mytcpio.c 2004/02/25 23:14:35 1.13 +++ OpenXM/src/kan96xx/plugin/mytcpio.c 2020/10/06 11:33:47 1.17 @@ -1,5 +1,6 @@ -/* $OpenXM: OpenXM/src/kan96xx/plugin/mytcpio.c,v 1.12 2003/09/16 02:57:39 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/plugin/mytcpio.c,v 1.16 2005/07/03 11:08:54 ohara Exp $ */ #include +#include #include #include #include @@ -7,6 +8,7 @@ #include #include #include +#include /* -lnsl -lsocket /usr/ucblib/libucb.a */ #include "ox_kan.h" /* @@ -34,7 +36,7 @@ FILE *TcpioError = NULL; int OpenedSocket = 0; extern int Quiet; -socketOpen(char *serverName,int portNumber) { +int socketOpen(char *serverName,int portNumber) { static struct hostent *myhost; static struct sockaddr_in me; static int s_waiting; @@ -42,7 +44,7 @@ socketOpen(char *serverName,int portNumber) { int tt; SET_TCPIOERROR; - fprintf(TcpioError,"Hello from open. serverName is %s and portnumber is %d\n", + if (!Quiet) fprintf(TcpioError,"Hello from open. serverName is %s and portnumber is %d\n", serverName,portNumber); if ((myhost = gethostbyname(serverName)) == NULL) { errorMsg1s("Bad server name."); @@ -78,18 +80,18 @@ socketOpen(char *serverName,int portNumber) { errorMsg1s("Listen failed"); return(-1); } - fprintf(TcpioError,"Done the initialization. port =%d\n",ntohs(me.sin_port)); + if (!Quiet) fprintf(TcpioError,"Done the initialization. port =%d\n",ntohs(me.sin_port)); OpenedSocket = ntohs(me.sin_port); return(s_waiting); } -socketAccept(int snum) { +int socketAccept(int snum) { int s, news; SET_TCPIOERROR; s = snum; - fprintf(TcpioError,"Trying to accept... "); fflush(TcpioError); + if (!Quiet) {fprintf(TcpioError,"Trying to accept... "); fflush(TcpioError);} if ((news = accept(s,NULL,NULL)) < 0) { errorMsg1s("Error in accept. Retrying (socketAccept)."); /* Code added for strange behavior on cygwin. */ @@ -98,7 +100,7 @@ socketAccept(int snum) { return (-1); } } - fprintf(TcpioError,"Accepted.\n"); fflush(TcpioError); + if (!Quiet) {fprintf(TcpioError,"Accepted.\n"); fflush(TcpioError);} if (close(s) < 0) { errorMsg1s("Error in closing the old socket."); return(-1); @@ -106,7 +108,7 @@ socketAccept(int snum) { return(news); } -socketAcceptLocal(int snum) { +int socketAcceptLocal(int snum) { int s, news; struct sockaddr peer; int len; @@ -114,7 +116,7 @@ socketAcceptLocal(int snum) { SET_TCPIOERROR; s = snum; - fprintf(TcpioError,"Trying to accept from localhost... "); fflush(TcpioError); + if (!Quiet) {fprintf(TcpioError,"Trying to accept from localhost... "); fflush(TcpioError);} len = sizeof(struct sockaddr); if ((news = accept(s,&peer,&len)) < 0) { errorMsg1s("Error in accept. Retrying"); @@ -127,14 +129,14 @@ socketAcceptLocal(int snum) { len = sizeof(struct sockaddr); getpeername(news,&peer,&len); - printf("len= %d\n",len); + if (!Quiet) printf("len= %d\n",len); for (i=0; i