From 660f0c8b54ec258afbc94f87d43337a2ac600f6a Mon Sep 17 00:00:00 2001 From: zolliker Date: Tue, 25 Sep 2007 06:56:06 +0000 Subject: [PATCH] - flush autologfile faster --- commandlog.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/commandlog.c b/commandlog.c index 41483133..f1825126 100644 --- a/commandlog.c +++ b/commandlog.c @@ -34,6 +34,8 @@ /*-------------------- the tail buffer ---------------------------------*/ static pCircular pTail = NULL; #define MAXTAIL 1000 +/*----------------------------------------------------------------------*/ + static time_t tLastWrite = 0; /*----------------------------------------------------------------------*/ void WriteToCommandLog(char *prompt,char *text) { @@ -113,6 +115,7 @@ /* automatic file */ if(fauto != NULL) { + time(&tLastWrite); if(iNL) { fprintf(fauto,"%s %s",prompt, pText); @@ -316,6 +319,11 @@ fflush(fauto); } + if (fauto && tLastWrite != 0 && tNow > tLastWrite) { + fflush(fauto); + tLastWrite = 0; + } + return iEnd; } /*----------- a command to configure the log --------------------------*/