All pastes #330659 Raw Edit

Anonymous

public text v1 · immutable
#330659 ·published 2007-01-28 03:21 UTC
rendered paste body
/* Flush the logfiles to disk
 */
void flushlogs()
{
  int i;

  /* Logs may not be initialised yet. */
  if (!logs)
    return;

  /* Now also checks to see if there's a repeat message and
   * displays the 'last message repeated...' stuff too <cybah>
   */
  for (i = 0; i < max_logs; i++) {
    if (logs[i].f != NULL) {
      if ((logs[i].repeats > 0) && quick_logs) {
        /* Repeat.. if quicklogs used then display 'last message
         * repeated x times' and reset repeats.
         */
        char stamp[33];

        egg_strftime(stamp, sizeof(stamp) - 1, LOG_TS, localtime(&now));
        fprintf(logs[i].f, "%s ", stamp);
        fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
        /* Reset repeats */
        logs[i].repeats = 0;
      }
      fflush(logs[i].f);
    }
  }
}