diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-01-01 21:38:25 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-01-01 21:38:25 +0100 |
commit | 30120d044c91980cc77d4ad1021f02bf3b356d7c (patch) | |
tree | 2e53893052015b38cc7966120dba63dd3dece03b | |
parent | ad93cd4e7052d40a91180450522ed58a71c909ea (diff) |
Reformatted com_handles() and replaced sprintf() with snprintf()
-rw-r--r-- | FICS/comproc.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/FICS/comproc.c b/FICS/comproc.c index 2c794a3..f76adc1 100644 --- a/FICS/comproc.c +++ b/FICS/comproc.c @@ -1701,18 +1701,21 @@ com_mailhelp(int p, param_list param) return COM_OK; } -PUBLIC int com_handles(int p, param_list param) +PUBLIC int +com_handles(int p, param_list param) { - char *buffer[1000]; - char pdir[MAX_FILENAME_SIZE]; - int count; - - sprintf(pdir, "%s/%c", player_dir, param[0].val.word[0]); - count = search_directory(pdir, param[0].val.word, buffer, 1000); - pprintf(p, "Found %d names.\n", count); - if (count > 0) - display_directory(p, buffer, count); - return COM_OK; + char *buffer[1000]; + char pdir[MAX_FILENAME_SIZE]; + int count; + + snprintf(pdir, sizeof pdir, "%s/%c", player_dir, param[0].val.word[0]); + count = search_directory(pdir, param[0].val.word, buffer, 1000); + pprintf(p, "Found %d names.\n", count); + + if (count > 0) + display_directory(p, buffer, count); + + return COM_OK; } PUBLIC int |