if (logs[i].f == NULL) {
/* Open this logfile */
if (keep_all_logs) {
egg_snprintf(s1, 256, "%s%s", logs[i].filename, ct);
logs[i].f = fopen(s1, "a+");
} else
logs[i].f = fopen(logs[i].filename, "a+");
}
if (logs[i].f != NULL) {
/* Check if this is the same as the last line added to
* the log. <cybah>
*/
if (!egg_strcasecmp(out + tsl, logs[i].szlast))
/* It is a repeat, so increment repeats */
logs[i].repeats++;
else {
/* Not a repeat, check if there were any repeat
* lines previously...
*/
if (logs[i].repeats > 0) {
/* Yep.. so display 'last message repeated x times'
* then reset repeats. We want the current time here,
* so put that in the file first.
*/
fprintf(logs[i].f, stamp);
fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
logs[i].repeats = 0;
/* No need to reset logs[i].szlast here
* because we update it later on...
*/
}
fputs(out, logs[i].f);
strncpyz(logs[i].szlast, out + tsl, LOGLINEMAX);
}
}