diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2024-04-23 18:38:11 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2024-04-23 18:38:11 +0200 |
commit | 1dd27bc24de1e88362317f101d443ccc894a2fc3 (patch) | |
tree | 69d655ee6d777bb1efe137b6979f93db7f118bbf /FICS/obsproc.c | |
parent | 3bc481239c1862ab6c04202fa825ed79af368c5f (diff) |
Reformatted com_stored()
Diffstat (limited to 'FICS/obsproc.c')
-rw-r--r-- | FICS/obsproc.c | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/FICS/obsproc.c b/FICS/obsproc.c index c8c406c..a2bc47f 100644 --- a/FICS/obsproc.c +++ b/FICS/obsproc.c @@ -907,45 +907,53 @@ PUBLIC int com_examine(int p, param_list param) return COM_OK; } -PUBLIC int com_stored(int p, param_list param) +PUBLIC int +com_stored(int p, param_list param) { - DIR *dirp; + DIR *dirp; + char dname[MAX_FILENAME_SIZE]; + int p1, connected; #ifdef USE_DIRENT - struct dirent *dp; + struct dirent *dp; #else - struct direct *dp; + struct direct *dp; #endif - int p1, connected; - char dname[MAX_FILENAME_SIZE]; - 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(dname, "%s/%c", adj_dir, parray[p1].login[0]); - dirp = opendir(dname); - if (!dirp) { - pprintf(p, "Player %s has no games stored.\n", parray[p1].name); - if (!connected) - player_remove(p1); - return COM_OK; - } - pprintf(p, "Stored games for %s:\n", parray[p1].name); - for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { - if (file_has_pname(dp->d_name, parray[p1].login)) { - pprintf(p, " %s vs. %s\n", file_wplayer(dp->d_name), file_bplayer(dp->d_name)); - } - } + sprintf(dname, "%s/%c", adj_dir, parray[p1].login[0]); + dirp = opendir(dname); - closedir(dirp); - pprintf(p, "\n"); - if (!connected) - player_remove(p1); - return COM_OK; + if (!dirp) { + pprintf(p, "Player %s has no games stored.\n", parray[p1].name); + + if (!connected) + player_remove(p1); + return COM_OK; + } + + pprintf(p, "Stored games for %s:\n", parray[p1].name); + + for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { + if (file_has_pname(dp->d_name, parray[p1].login)) { + pprintf(p, " %s vs. %s\n", + file_wplayer(dp->d_name), + file_bplayer(dp->d_name)); + } + } + + closedir(dirp); + pprintf(p, "\n"); + + if (!connected) + player_remove(p1); + return COM_OK; } PRIVATE void |