Match all the chars in multichar terminators that are prefixed with '&'.
r981 | ffr | 2006-05-08 13:39:25 +1000 (Mon, 08 May 2006) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
d4923a14d8
commit
1152141fa2
28
network.c
28
network.c
@@ -555,7 +555,7 @@ int NETReadTillTerm(mkChannel *self, long timeout,
|
|||||||
char *pTerm, char *pBuffer, int iBufLen)
|
char *pTerm, char *pBuffer, int iBufLen)
|
||||||
{
|
{
|
||||||
struct timeval start, now;
|
struct timeval start, now;
|
||||||
int bufPtr = 0, status, i, length;
|
int bufPtr = 0, status, i, length, matchIndex=1;
|
||||||
char c;
|
char c;
|
||||||
long dif;
|
long dif;
|
||||||
|
|
||||||
@@ -583,11 +583,29 @@ int NETReadTillTerm(mkChannel *self, long timeout,
|
|||||||
{
|
{
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
for(i = 0; i < length; i++)
|
if ('&' != pTerm[0]) {
|
||||||
{
|
for(i = 0; i < length; i++)
|
||||||
if(c == pTerm[i])
|
|
||||||
{
|
{
|
||||||
return bufPtr+1;
|
if(c == pTerm[i])
|
||||||
|
{
|
||||||
|
return bufPtr+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (matchIndex == 1 && c == pTerm[1]) {
|
||||||
|
matchIndex++;
|
||||||
|
} else {
|
||||||
|
if (c== pTerm[matchIndex] && matchIndex < length -1) {
|
||||||
|
matchIndex++;
|
||||||
|
} else {
|
||||||
|
if (c == pTerm[matchIndex] && matchIndex == length - 1) {
|
||||||
|
bufPtr = bufPtr - matchIndex + 1;
|
||||||
|
pBuffer[bufPtr] = '\0';
|
||||||
|
return bufPtr;
|
||||||
|
} else {
|
||||||
|
matchIndex == 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c == 0 && *pTerm != 0)
|
if (c == 0 && *pTerm != 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user