From 34b08a0e45003daf1e8db447d0201ae76d70d77d Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Sun, 31 Dec 2023 16:11:39 +0100 Subject: Changed write_p_inout() --- FICS/playerdb.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'FICS') diff --git a/FICS/playerdb.c b/FICS/playerdb.c index fdf5bb4..c89325a 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -1209,18 +1209,22 @@ PUBLIC int player_ontime(int p) return time(0) - parray[p].logon_time; } -PRIVATE void write_p_inout(int inout, int p, char *file, int maxlines) +PRIVATE void +write_p_inout(int inout, int p, char *file, int maxlines) { - FILE *fp; + FILE *fp; - fp = fopen(file, "a"); - if (!fp) - return; - fprintf(fp, "%d %s %d %d %s\n", inout, parray[p].name, (int) time(0), - parray[p].registered, dotQuad(parray[p].thisHost)); - fclose(fp); - if (maxlines) - truncate_file(file, maxlines); + if ((fp = fopen(file, "a")) == NULL) + return; + + fprintf(fp, "%d %s %ld %d %s\n", inout, parray[p].name, + (long int)time(NULL), parray[p].registered, + dotQuad(parray[p].thisHost)); + + fclose(fp); + + if (maxlines) + truncate_file(file, maxlines); } PUBLIC void -- cgit v1.2.3