- Fixed a bug in conman.c which could cause a core dump when terminating

a connection during an active run.
- Added an additional output mode for the connection in order to
  support the batch run editor.
- Made clientput send everything with eWarning mode in order to support
  the batch run editor.
- Added a better NetReadTillTerm
- Fixed a problem in synchronize.c
- Fixed an issue with reading empty line on normal connection sockets.
- Added a psi scan mode to mesure.c for TRICS
- Made motor print warnings when trying to reposition.
- Fixed abug in hkl.c which cause wrong signs.


SKIPPED:
	psi/el734driv.c
	psi/el734hp.c
	psi/el737driv.c
	psi/el737hpdriv.c
	psi/nextrics.c
	psi/nxamor.c
	psi/psi.c
	psi/slsmagnet.c
	psi/swmotor2.c
	psi/tasscan.c
	psi/tasutil.c
This commit is contained in:
cvs
2004-07-21 12:03:06 +00:00
parent 6bfeac8c02
commit a55d2f0f7f
41 changed files with 823 additions and 372 deletions

View File

@ -1,6 +1,6 @@
/*--------------------------------------------------------------------------
Some metworking functions. This version for TCP/IP.
Some networking functions. This version for TCP/IP.
@ -42,6 +42,7 @@
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <unistd.h>
#include <netdb.h>
@ -456,7 +457,81 @@ CreateSocketAdress(
return 0;
}
}
/*--------------------------------------------------------------------------*/
/*------------------------------------------------------------------------*/
static int findTerm(char *buffer, char *term)
{
int i, j;
for(i = 0; i < strlen(buffer); i++)
{
for(j = 0; j < strlen(term); j++)
{
if(buffer[i] == term[j])
{
return i;
}
}
}
return -1;
}
/*-------------------------------------------------------------------------*/
int NETReadTillTermNew(mkChannel *self, int timeout,
char *pTerm, char *pBuffer, int iBufLen)
{
time_t maxTime;
int bufPtr = 0, status, i, length;
char c;
if(!VerifyChannel(self))
{
return -1;
}
maxTime = time(NULL) + (time_t)ceil((double)timeout/1000);
length = strlen(pTerm);
memset(pBuffer,0,iBufLen);
while(time(NULL) < maxTime)
{
/*
is data available
*/
status = NETAvailable(self,5);
if(status < 0)
{
return status;
}
if(status == 0)
{
continue;
}
status = recv(self->sockid,&c,1,0);
if(status < 0)
{
return status;
}
/*
printf("Read char %c\n",c);
*/
for(i = 0; i < length; i++)
{
if(c == pTerm[i])
{
return 1;
}
}
if(iBufLen - bufPtr > 0)
{
pBuffer[bufPtr] = c;
bufPtr++;
}
}
return 0; /* timeout */
}
/*--------------------------------------------------------------------------
This old version may be removed in some stage. It has two problems:
- The timeouts are not properly obeyed
- The code may read more data the it should, i.e. bytes after the
terminator of your hearts desire.
-------------------------------------------------------------------------*/
int NETReadTillTerm(mkChannel *self, int timeout,
char *pTerm, char *pBuffer, int iBufLen)
{