aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-28 23:56:54 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-28 23:56:54 +0100
commit289ea822ea984d2c5ab8aae07d14d50ccd7f2a5b (patch)
tree8aec55e486194a9df40a7a011c1ef2ef64e9e0f1 /FICS
parent1c359cbd9e7db3448cbeb9f164e06ae0dd59d296 (diff)
Reformatted player_reincarn() and switched to usage of snprintf()
Diffstat (limited to 'FICS')
-rw-r--r--FICS/playerdb.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index fafa0af..c3b5c24 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -2370,26 +2370,43 @@ PUBLIC int player_raise(char *name)
return 0;
}
-PUBLIC int player_reincarn(char *name, char *newname)
-{
- char fname[MAX_FILENAME_SIZE], fname2[MAX_FILENAME_SIZE];
+PUBLIC int
+player_reincarn(char *name, char *newname)
+{
+ char fname[MAX_FILENAME_SIZE];
+ char fname2[MAX_FILENAME_SIZE];
+
+ snprintf(fname, sizeof fname, "%s/%c/%s", player_dir,
+ newname[0], newname);
+ 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, newname[0], newname);
+ 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, newname[0], newname);
+ 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, newname[0], newname);
+ 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, newname[0], newname);
+ snprintf(fname2, sizeof fname2, "%s/player_data/%c/.rem.%s.messages",
+ stats_dir, name[0], name);
+ rename(fname2, fname);
- sprintf(fname, "%s/%c/%s", player_dir, newname[0], newname);
- sprintf(fname2, "%s/%c/.rem.%s", player_dir, name[0], name);
- rename(fname2, fname);
- sprintf(fname, "%s/player_data/%c/%s.games", stats_dir, newname[0], newname);
- 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, newname[0], newname);
- 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, newname[0], newname);
- 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, newname[0], newname);
- sprintf(fname2, "%s/player_data/%c/.rem.%s.messages", stats_dir, name[0], name);
- rename(fname2, fname);
- return 0;
+ return 0;
}
PUBLIC int