PSI sics-cvs-psi-2008-10-02
This commit is contained in:
23
servlog.c
23
servlog.c
@@ -236,6 +236,7 @@
|
||||
int OpenVerifyLogFile()
|
||||
{
|
||||
char pFile[256];
|
||||
char filnam[512];
|
||||
char *pChar = NULL;
|
||||
|
||||
pChar = IFindOption(pSICSOptions,"LogFileBaseName");
|
||||
@@ -245,10 +246,10 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(pFile,pChar);
|
||||
strncpy(pFile,pChar,255);
|
||||
}
|
||||
sprintf(pFile,"%s%2.2d.log",pFile, iFile);
|
||||
fLogFile = fopen(pFile,"w");
|
||||
snprintf(filnam,511,"%s%2.2d.log",pFile, iFile);
|
||||
fLogFile = fopen(filnam,"w");
|
||||
if(!fLogFile)
|
||||
{
|
||||
fprintf(stderr,"ERROR: Cannot open logfile %s for writing\n",pFile);
|
||||
@@ -261,6 +262,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void SICSLogEnable(int flag) {
|
||||
iLogUsable=flag;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void SICSLogWrite(char *pText, OutCode eOut)
|
||||
{
|
||||
@@ -280,6 +285,7 @@
|
||||
if( (pCurrent->iOut == eOut) || (pCurrent->iAllFlag == 1) )
|
||||
{
|
||||
NETWrite(pCurrent->pCon->pSock,pText,strlen(pText));
|
||||
NETWrite(pCurrent->pCon->pSock,"\n",1);
|
||||
}
|
||||
pCurrent = pCurrent->pNext;
|
||||
}
|
||||
@@ -316,16 +322,5 @@
|
||||
fprintf(fLogFile,"%s\n",pText);
|
||||
fflush(fLogFile);
|
||||
iLineCount++;
|
||||
|
||||
/* do all captured as well */
|
||||
pCurrent = pCapture;
|
||||
while(pCurrent)
|
||||
{
|
||||
if( (pCurrent->iOut == eOut) || (pCurrent->iAllFlag == 1) )
|
||||
{
|
||||
NETWrite(pCurrent->pCon->pSock,pText,strlen(pText));
|
||||
}
|
||||
pCurrent = pCurrent->pNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user