aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/playerdb.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-29 00:07:34 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-29 00:07:34 +0100
commit7dd697ee891109f60b646a49de5612e7a2f50deb (patch)
tree788f2c3a6146bac5edc9cb9e5351674271f780e6 /FICS/playerdb.c
parent66966b9cdf8b42baf1027f25139ff0b13e33f032 (diff)
Reformatted player_raise() and switched to usage of snprintf()
Diffstat (limited to 'FICS/playerdb.c')
-rw-r--r--FICS/playerdb.c53
1 files changed, 35 insertions, 18 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index c3b5c24..6ad941a 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -2348,26 +2348,43 @@ PUBLIC int player_rename(char *name, char *newname)
return 0;
}
-PUBLIC int player_raise(char *name)
+PUBLIC int
+player_raise(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(fname2, fname);
- 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(fname2, fname);
- 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(fname2, fname);
- 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(fname2, fname);
- 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(fname2, fname);
- return 0;
+ 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(fname2, fname);
+
+ 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(fname2, fname);
+
+ 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(fname2, fname);
+
+ 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(fname2, fname);
+
+ 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(fname2, fname);
+
+ return 0;
}
PUBLIC int