diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-31 17:54:39 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-31 17:54:39 +0100 |
commit | f1006c5174fe32ff591479c0511178494e74877e (patch) | |
tree | d08ff2b20aee2d257912f703f3f4dab3f873b74f /FICS/playerdb.c | |
parent | 7078821e5c3b327db486e73a501c7f04c89e5f96 (diff) |
Reformatted player_markdeleted()
Diffstat (limited to 'FICS/playerdb.c')
-rw-r--r-- | FICS/playerdb.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c index e05221a..fb616ac 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -838,28 +838,28 @@ PUBLIC int player_delete(int p) return 0; } -PUBLIC int player_markdeleted(int p) +PUBLIC int +player_markdeleted(int p) { - FILE *fp; - char fname[MAX_FILENAME_SIZE], fname2[MAX_FILENAME_SIZE]; + FILE *fp; + char fname[MAX_FILENAME_SIZE]; + char fname2[MAX_FILENAME_SIZE]; - if (!parray[p].registered) { /* Player must not be registered */ - return -1; - } -/* if (iamserver) { - sprintf(fname, "%s.server/%c/%s", player_dir, parray[p].login[0], parray[p].login); - sprintf(fname2, "%s.server/%c/%s.delete", player_dir, parray[p].login[0], parray[p].login); - } else {*/ - sprintf(fname, "%s/%c/%s", player_dir, parray[p].login[0], parray[p].login); - sprintf(fname2, "%s/%c/%s.delete", player_dir, parray[p].login[0], parray[p].login); -/* } */ - rename(fname, fname2); - fp = fopen(fname2, "a"); /* Touch the file */ - if (fp) { - fprintf(fp, "\n"); - fclose(fp); - } - return 0; + if (!parray[p].registered) // Player must not be registered + return -1; + + snprintf(fname, sizeof fname, "%s/%c/%s", player_dir, + parray[p].login[0], parray[p].login); + snprintf(fname2, sizeof fname2, "%s/%c/%s.delete", player_dir, + parray[p].login[0], parray[p].login); + rename(fname, fname2); + + if ((fp = fopen(fname2, "a")) != NULL) { // Touch the file + fprintf(fp, "\n"); + fclose(fp); + } + + return 0; } void |