diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-29 00:25:38 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-29 00:25:38 +0100 |
commit | 9ffd14e8df861a2fb7d8c69414f3b9e9ec761a60 (patch) | |
tree | 51518c7b67b450accc9e32b02b8e28f991a41fa2 | |
parent | 3b19243ace0f1c58e652fda2188db97986d1faaf (diff) |
Reformatted player_kill() and switched to usage of snprintf()
-rw-r--r-- | FICS/playerdb.c | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c index ce69b42..aaa266f 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -2302,28 +2302,45 @@ ReadPlayerFromFile: } -PUBLIC int player_kill(char *name) +PUBLIC int +player_kill(char *name) { - char fname[MAX_FILENAME_SIZE], fname2[MAX_FILENAME_SIZE]; + char fname[MAX_FILENAME_SIZE]; + char fname2[MAX_FILENAME_SIZE]; - sprintf(fname, "%s/%c/%s", player_dir, name[0], name); - sprintf(fname2, "%s/%c/.rem.%s", player_dir, name[0], name); - rename(fname, fname2); - RemHist (name); - sprintf(fname, "%s/player_data/%c/%s.games", stats_dir, name[0], name); - sprintf(fname2, "%s/player_data/%c/.rem.%s.games", stats_dir, name[0], name); - rename(fname, fname2); - sprintf(fname, "%s/player_data/%c/%s.comments", stats_dir, name[0], name); - sprintf(fname2, "%s/player_data/%c/.rem.%s.comments", stats_dir, name[0], name); - rename(fname, fname2); + snprintf(fname, sizeof fname, "%s/%c/%s", player_dir, name[0], + name); + snprintf(fname2, sizeof fname2, "%s/%c/.rem.%s", player_dir, name[0], + name); + rename(fname, fname2); - sprintf(fname, "%s/player_data/%c/%s.logons", stats_dir, name[0], name); - sprintf(fname2, "%s/player_data/%c/.rem.%s.logons", stats_dir, name[0], name); - rename(fname, fname2); - sprintf(fname, "%s/player_data/%c/%s.messages", stats_dir, name[0], name); - sprintf(fname2, "%s/player_data/%c/.rem.%s.messages", stats_dir, name[0], name); - rename(fname, fname2); - return 0; + RemHist(name); + + snprintf(fname, sizeof fname, "%s/player_data/%c/%s.games", + stats_dir, name[0], name); + snprintf(fname2, sizeof fname2, "%s/player_data/%c/.rem.%s.games", + stats_dir, name[0], name); + rename(fname, fname2); + + snprintf(fname, sizeof fname, "%s/player_data/%c/%s.comments", + stats_dir, name[0], name); + snprintf(fname2, sizeof fname2, "%s/player_data/%c/.rem.%s.comments", + stats_dir, name[0], name); + rename(fname, fname2); + + snprintf(fname, sizeof fname, "%s/player_data/%c/%s.logons", + stats_dir, name[0], name); + snprintf(fname2, sizeof fname2, "%s/player_data/%c/.rem.%s.logons", + stats_dir, name[0], name); + rename(fname, fname2); + + snprintf(fname, sizeof fname, "%s/player_data/%c/%s.messages", + stats_dir, name[0], name); + snprintf(fname2, sizeof fname2, "%s/player_data/%c/.rem.%s.messages", + stats_dir, name[0], name); + rename(fname, fname2); + + return 0; } PUBLIC int |