diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-17 03:53:40 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-17 03:53:40 +0200 |
commit | a7acaca2a21ba90173079c9ecd5e01a4a22b04ae (patch) | |
tree | 9491c06278d8a50098146c6059eb2fccd56522fd /FICS/obsproc.c | |
parent | 73ab7a6235ee93b845d000080a3f5fc299113078 (diff) |
Revised com_history()
Diffstat (limited to 'FICS/obsproc.c')
-rw-r--r-- | FICS/obsproc.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c index dadcda6..a9cf6d4 100644 --- a/FICS/obsproc.c +++ b/FICS/obsproc.c @@ -1354,25 +1354,27 @@ PUBLIC int com_revert(int p, param_list param) return COM_OK; } -PUBLIC int com_history(int p, param_list param) +PUBLIC int +com_history(int p, param_list param) { - int p1, connected; - char fname[MAX_FILENAME_SIZE]; + char fname[MAX_FILENAME_SIZE] = { '\0' }; + int p1, connected; - if (param[0].type == TYPE_WORD) { - if (!FindPlayer(p, param[0].val.word, &p1, &connected)) - return COM_OK; - } else { - p1 = p; - connected = 1; - } + if (param[0].type == TYPE_WORD) { + if (!FindPlayer(p, param[0].val.word, &p1, &connected)) + return COM_OK; + } else { + p1 = p; + connected = 1; + } - sprintf(fname, "%s/player_data/%c/%s.%s", stats_dir, parray[p1].login[0], - parray[p1].login, STATS_GAMES); - pgames(p, p1, fname); - if (!connected) - player_remove(p1); - return COM_OK; + msnprintf(fname, sizeof fname, "%s/player_data/%c/%s.%s", stats_dir, + parray[p1].login[0], parray[p1].login, STATS_GAMES); + pgames(p, p1, fname); + + if (!connected) + player_remove(p1); + return COM_OK; } PUBLIC int |