Remove "color" string from diag8 response and from logger processes after panel is shutdown.

git-svn-id: file:///home/jj/hercules.svn/trunk@6936 956126f8-22a0-4046-8f4a-272fa8102e63
This commit is contained in:
Paul Gorlinsky
2010-10-18 03:40:21 +00:00
parent 1b3c4fdb31
commit bcbf5d018a
2 changed files with 51 additions and 2 deletions

View File

@@ -202,7 +202,37 @@ static void logger_term(void *arg)
fwrite("\n",1,1,stderr);
/* Read and display any msgs still remaining in the system log */
while((lmscnt = log_read(&lmsbuf, &lmsnum, LOG_NOBLOCK)))
fwrite(lmsbuf,lmscnt,1,stderr);
{
char *p = NULL;
char *strtok_str = NULL;
lmsbuf[lmscnt-1] = '\0';
p = strtok_r( lmsbuf, "\n", &strtok_str );
while ( (p = strtok_r(NULL, "\n", &strtok_str ) ) != NULL )
{
char* pLeft = p;
int nLeft = (int)strlen(p);
#if defined( OPTION_MSGCLR )
/* Remove "<pnl,..." color string if it exists */
if (1
&& nLeft > 5
&& strncasecmp( pLeft, "<pnl", 4 ) == 0
&& (pLeft = memchr( pLeft+4, '>', nLeft-4 )) != NULL
)
{
pLeft++;
nLeft -= (int)(pLeft - p);
}
#endif // defined( OPTION_MSGCLR )
if (nLeft)
{
fwrite(pLeft,nLeft,1,stderr);
fwrite("\n",1,1,stderr);
}
}
}
fflush(stderr);
}
}

View File

@@ -459,7 +459,26 @@ DLL_EXPORT void log_write(int panel,char *msg)
if ( ptr != NULL ) free(ptr);
log_routes[slot].w(log_routes[slot].u,msg);
/* strip color part of message */
{
char* pLeft = msg;
int nLeft = (int)strlen(msg);
#if defined( OPTION_MSGCLR )
/* Remove "<pnl,..." color string if it exists */
if ( 1
&& nLeft > 5
&& strncasecmp( pLeft, "<pnl", 4 ) == 0
&& (pLeft = memchr( pLeft+4, '>', nLeft-4 )) != NULL
)
{
pLeft++;
nLeft -= (int)(pLeft - (char*)msg);
}
#endif // defined( OPTION_MSGCLR )
if (nLeft)
log_routes[slot].w(log_routes[slot].u,pLeft);
}
return;
}