diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-31 16:11:39 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-31 16:11:39 +0100 |
commit | 34b08a0e45003daf1e8db447d0201ae76d70d77d (patch) | |
tree | 2840f0a33a4bb221c3184efa0cc3c596af09e3a2 | |
parent | 81ca709ab63a4f049039e7e0aa3c435ac2510622 (diff) |
Changed write_p_inout()
-rw-r--r-- | FICS/playerdb.c | 24 |
1 files changed, 14 insertions, 10 deletions
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 |