aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/gamedb.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-05-04 13:01:23 +0200
committerMarkus Uhlin <markus@nifty-networks.net>2024-05-04 13:01:23 +0200
commit5439ab24268bd92a2fae1cd4bea0616d60a369d8 (patch)
tree49a0d04d41dd1bdaba488b0122dad3c32ecc6cf3 /FICS/gamedb.c
parentd1a9e9edaa8c2af0d14e2c5debbcecc6124ad2a6 (diff)
Reformatted ReadMove()
Diffstat (limited to 'FICS/gamedb.c')
-rw-r--r--FICS/gamedb.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c
index 81866e9..f46ad6d 100644
--- a/FICS/gamedb.c
+++ b/FICS/gamedb.c
@@ -743,16 +743,29 @@ WriteMoves(FILE *fp, move_t *m)
return 0;
}
-PRIVATE int ReadMove(FILE * fp, move_t *m)
+PRIVATE int
+ReadMove(FILE *fp, move_t *m)
{
- char line[MAX_GLINE_SIZE];
- fgets(line, MAX_GLINE_SIZE - 1, fp);
- if (sscanf(line, "%d %d %d %d %d %d %d %d %d \"%[^\"]\" \"%[^\"]\" %u %u\n",
- &m->color, &m->fromFile, &m->fromRank, &m->toFile, &m->toRank,
- &m->pieceCaptured, &m->piecePromotionTo, &m->enPassant, &m->doublePawn,
- m->moveString, m->algString, &m->atTime, &m->tookTime) != 13)
- return -1;
- return 0;
+ char line[MAX_GLINE_SIZE] = { '\0' };
+
+ fgets(line, sizeof line, fp);
+
+ if (sscanf(line, "%d %d %d %d %d %d %d %d %d \"%[^\"]\" \"%[^\"]\" "
+ "%u %u\n",
+ &m->color,
+ &m->fromFile, &m->fromRank,
+ &m->toFile, &m->toRank,
+ &m->pieceCaptured,
+ &m->piecePromotionTo,
+ &m->enPassant,
+ &m->doublePawn,
+ m->moveString,
+ m->algString,
+ &m->atTime,
+ &m->tookTime) != 13)
+ return -1;
+
+ return 0;
}
PRIVATE void