aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-04-02 18:32:37 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-04-02 18:32:37 +0200
commit935a6ae3c1d2bb70bfa5e0749188acee0988642a (patch)
tree34f2dcba9a9277e6dffdb28ed4dd836a33e959de /FICS
parent6486ebbd5c1ccd3c7734329f1f09c4510d851bf5 (diff)
Reformatted PositionFilePtr()
Diffstat (limited to 'FICS')
-rw-r--r--FICS/ratings.c47
1 files changed, 26 insertions, 21 deletions
diff --git a/FICS/ratings.c b/FICS/ratings.c
index 5ea446f..2b8f459 100644
--- a/FICS/ratings.c
+++ b/FICS/ratings.c
@@ -1080,29 +1080,34 @@ PRIVATE int GetRank(FILE * fp, char *target, int countComp)
return (playerFound ? count : -1);
}
-PRIVATE void PositionFilePtr(FILE * fp, int count, int *last,
- int *nTied, int showComp)
+PRIVATE void
+PositionFilePtr(FILE *fp, int count, int *last, int *nTied, int showComp)
{
- int i, rating, nGames, is_computer;
- char login[MAX_LOGIN_NAME];
- char line[MAX_RANK_LINE];
+ char line[MAX_RANK_LINE] = { '\0' };
+ char login[MAX_LOGIN_NAME] = { '\0' };
+ int rating, nGames, is_computer;
- if (fp == NULL)
- return;
- rewind(fp);
- for (i = 1; i < count; i++) {
- do {
- fgets(line, MAX_RANK_LINE - 1, fp);
- if (feof(fp))
- break;
- sscanf(line, "%s %d %d %d", login, &rating, &nGames, &is_computer);
- } while (!CountRankLine(showComp, login, nGames, is_computer));
- if (rating != *last) {
- *nTied = 1;
- *last = rating;
- } else
- (*nTied)++;
- }
+ if (fp == NULL)
+ return;
+
+ rewind(fp);
+
+ for (int i = 1; i < count; i++) {
+ do {
+ fgets(line, MAX_RANK_LINE - 1, fp);
+
+ if (feof(fp))
+ break;
+ sscanf(line, "%s %d %d %d", login, &rating, &nGames,
+ &is_computer);
+ } while (!CountRankLine(showComp, login, nGames, is_computer));
+
+ if (rating != *last) {
+ *nTied = 1;
+ *last = rating;
+ } else
+ (*nTied)++;
+ }
}
PRIVATE int