aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-31 16:06:50 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-31 16:06:50 +0100
commit81ca709ab63a4f049039e7e0aa3c435ac2510622 (patch)
treee725fea369a5759157a010d5f727c568d63adedd /FICS
parent357adbac88b037e91f99a52944220d0fe276b5d5 (diff)
Reformatted functions and replaced sprintf() calls
Diffstat (limited to 'FICS')
-rw-r--r--FICS/playerdb.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index 05ea4ba..fdf5bb4 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -1223,34 +1223,42 @@ PRIVATE void write_p_inout(int inout, int p, char *file, int maxlines)
truncate_file(file, maxlines);
}
-PUBLIC void player_write_login(int p)
+PUBLIC void
+player_write_login(int p)
{
- char fname[MAX_FILENAME_SIZE];
+ char fname[MAX_FILENAME_SIZE];
- if (parray[p].registered) {
- sprintf(fname, "%s/player_data/%c/%s.%s", stats_dir, parray[p].login[0], parray[p].login, STATS_LOGONS);
- write_p_inout(P_LOGIN, p, fname, 8);
- }
- sprintf(fname, "%s/%s", stats_dir, STATS_LOGONS);
- write_p_inout(P_LOGIN, p, fname, 30);
- /* added complete login/logout log to "logons.log" file */
- sprintf(fname, "%s/%s", stats_dir, "logons.log");
- write_p_inout(P_LOGIN, p, fname, 0);
+ if (parray[p].registered) {
+ snprintf(fname, sizeof fname, "%s/player_data/%c/%s.%s",
+ stats_dir, parray[p].login[0], parray[p].login,
+ STATS_LOGONS);
+ write_p_inout(P_LOGIN, p, fname, 8);
+ }
+
+ snprintf(fname, sizeof fname, "%s/%s", stats_dir, STATS_LOGONS);
+ write_p_inout(P_LOGIN, p, fname, 30);
+
+ snprintf(fname, sizeof fname, "%s/%s", stats_dir, "logons.log");
+ write_p_inout(P_LOGIN, p, fname, 0);
}
-PUBLIC void player_write_logout(int p)
+PUBLIC void
+player_write_logout(int p)
{
- char fname[MAX_FILENAME_SIZE];
+ char fname[MAX_FILENAME_SIZE];
- if (parray[p].registered) {
- sprintf(fname, "%s/player_data/%c/%s.%s", stats_dir, parray[p].login[0], parray[p].login, STATS_LOGONS);
- write_p_inout(P_LOGOUT, p, fname, 8);
- }
- sprintf(fname, "%s/%s", stats_dir, STATS_LOGONS);
- write_p_inout(P_LOGOUT, p, fname, 30);
- /* added complete login/logout log to "logons.log" file */
- sprintf(fname, "%s/%s", stats_dir, "logons.log");
- write_p_inout(P_LOGOUT, p, fname, 0);
+ if (parray[p].registered) {
+ snprintf(fname, sizeof fname, "%s/player_data/%c/%s.%s",
+ stats_dir, parray[p].login[0], parray[p].login,
+ STATS_LOGONS);
+ write_p_inout(P_LOGOUT, p, fname, 8);
+ }
+
+ snprintf(fname, sizeof fname, "%s/%s", stats_dir, STATS_LOGONS);
+ write_p_inout(P_LOGOUT, p, fname, 30);
+
+ snprintf(fname, sizeof fname, "%s/%s", stats_dir, "logons.log");
+ write_p_inout(P_LOGOUT, p, fname, 0);
}
PUBLIC time_t