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 --------------------------*/