
API in C
227
}
}
// if any errors, get the next sentence
if (stReturnSentence.iReturnValue == TRAP || stReturnSentence.iReturnValue == FATAL)
{
readSentence(fdSock);
}
if (DEBUG)
{
for (i=0; i<stReturnSentence.iLength; i++)
{
printf("stReturnSentence.szSentence[%d] = %s\n", i, stReturnSentence.szSentence[i]);
}
}
return stReturnSentence;
}
/********************************************************************
* Read sentence block from the socket...keeps reading sentences
* until it encounters !done, !trap or !fatal from the socket
********************************************************************/
struct Block readBlock(int fdSock)
{
struct Sentence stSentence;
struct Block stBlock;
initializeBlock(&stBlock);
DEBUG ? printf("readBlock\n") : 0;
do
{
stSentence = readSentence(fdSock);
DEBUG ? printf("readSentence succeeded.\n") : 0;
addSentenceToBlock(&stBlock, &stSentence);
DEBUG ? printf("addSentenceToBlock succeeded\n") : 0;
} while (stSentence.iReturnValue == 0);
DEBUG ? printf("readBlock completed successfully\n") : 0;
Komentarze do niniejszej Instrukcji