- 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:
77
nread.c
77
nread.c
@@ -218,12 +218,15 @@ extern VerifyChannel(mkChannel *self); /* defined in network.c */
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
#define COLLECT 0
|
||||
#define SKIPTERM 1
|
||||
/*------------------------------------------------------------------------*/
|
||||
static int NetReadRead(pNetRead self, pNetItem pItem)
|
||||
{
|
||||
char *pPtr, *pEnd, *pBufEnd;
|
||||
char pBuffer[1024], pMuell[20];
|
||||
char pBueffel[80];
|
||||
int i, iInt, iRet, iStat;
|
||||
int i, iInt, iRet, iStat, state;
|
||||
|
||||
/* read first */
|
||||
memset(pBuffer,0,1024);
|
||||
@@ -271,42 +274,60 @@ extern VerifyChannel(mkChannel *self); /* defined in network.c */
|
||||
pBufEnd = pBuffer + iRet;
|
||||
pPtr = pBuffer;
|
||||
pEnd = pBuffer;
|
||||
state = COLLECT;
|
||||
while(pEnd < pBufEnd)
|
||||
{
|
||||
if( (*pEnd != '\r') && (*pEnd != '\n'))
|
||||
switch(state)
|
||||
{
|
||||
pEnd++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* there is a string between pPtr and pEnd */
|
||||
*pEnd = '\0';
|
||||
/* do we have something in hold ? */
|
||||
if(strlen(pItem->pHold) > 0)
|
||||
{
|
||||
strcat(pItem->pHold,pPtr);
|
||||
iStat = CostaTop(pItem->pCon->pStack,pItem->pHold);
|
||||
if(!iStat)
|
||||
case COLLECT:
|
||||
if( (*pEnd != '\r') && (*pEnd != '\n'))
|
||||
{
|
||||
pEnd++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* there is a string between pPtr and pEnd */
|
||||
*pEnd = '\0';
|
||||
/* do we have something in hold ? */
|
||||
if(strlen(pItem->pHold) > 0)
|
||||
{
|
||||
SCWrite(pItem->pCon,"ERROR: Busy",eError);
|
||||
strcat(pItem->pHold,pPtr);
|
||||
iStat = CostaTop(pItem->pCon->pStack,pItem->pHold);
|
||||
if(!iStat)
|
||||
{
|
||||
SCWrite(pItem->pCon,"ERROR: Busy",eError);
|
||||
}
|
||||
pItem->pHold[0] = '\0';
|
||||
}
|
||||
pItem->pHold[0] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* no, normal command */
|
||||
iStat = CostaTop(pItem->pCon->pStack,pPtr);
|
||||
if(!iStat)
|
||||
else
|
||||
{
|
||||
SCWrite(pItem->pCon,"ERROR: Busy",eError);
|
||||
}
|
||||
}
|
||||
pPtr = pEnd +1;
|
||||
pEnd = pPtr;
|
||||
/* no, normal command */
|
||||
iStat = CostaTop(pItem->pCon->pStack,pPtr);
|
||||
if(!iStat)
|
||||
{
|
||||
SCWrite(pItem->pCon,"ERROR: Busy",eError);
|
||||
}
|
||||
}
|
||||
pPtr = pEnd +1;
|
||||
pEnd = pPtr;
|
||||
state = SKIPTERM;
|
||||
}
|
||||
break;
|
||||
case SKIPTERM:
|
||||
if( (*pEnd != '\r') && (*pEnd != '\n'))
|
||||
{
|
||||
state = COLLECT;
|
||||
pPtr = pEnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
pEnd++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* when we are here we may still have an incomplete command pending */
|
||||
if(pEnd != pPtr)
|
||||
if(pEnd != pPtr && strlen(pEnd) > 0)
|
||||
{
|
||||
strcpy(pItem->pHold,pPtr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user