diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2025-04-01 19:59:15 +0200 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2025-04-01 19:59:15 +0200 |
commit | 1a7edbe81343c894b105b0bab60c2599ef896f78 (patch) | |
tree | 625a4cf4abdf22aa35f116f01b37bcc44821728d | |
parent | 280310adacaa60845c8e02881b9d0167408d8e42 (diff) |
Changed journal_get_info() -- usage of a context struct
-rw-r--r-- | FICS/gamedb.c | 24 | ||||
-rw-r--r-- | FICS/gamedb.h | 3 |
2 files changed, 12 insertions, 15 deletions
diff --git a/FICS/gamedb.c b/FICS/gamedb.c index a34fd89..85fcf40 100644 --- a/FICS/gamedb.c +++ b/FICS/gamedb.c @@ -1844,38 +1844,36 @@ write_g_out(int g, char *file, int maxlines, int isDraw, char *EndSymbol, * Find from_spot in journal list - return 0 if corrupted */ PUBLIC int -journal_get_info(int p, char from_spot, char *WhiteName, int *WhiteRating, - char *BlackName, int *BlackRating, char *type, int *t, int *i, char *eco, - char *ending, char *result, char *fname) +journal_get_info(struct JGI_context *ctx, const char *fname) { FILE *fp; char count; if ((fp = fopen(fname, "r")) == NULL) { fprintf(stderr, "Corrupt journal file! %s\n", fname); - pprintf(p, "The journal file is corrupt! See an admin.\n"); + pprintf(ctx->p, "The journal file is corrupt! See an admin.\n"); return 0; } while (!feof(fp)) { if (fscanf(fp, "%c %s %d %s %d %s %d %d %s %s %s\n", &count, - WhiteName, &(*WhiteRating), - BlackName, &(*BlackRating), - type, - &(*t), &(*i), - eco, - ending, - result) != 11) { + ctx->WhiteName, &ctx->WhiteRating, + ctx->BlackName, &ctx->BlackRating, + ctx->type, + &ctx->t, &ctx->i, + ctx->eco, + ctx->ending, + ctx->result) != 11) { fprintf(stderr, "FICS: Error in journal info format. " "%s\n", fname); - pprintf(p, "The journal file is corrupt! Error in " + pprintf(ctx->p, "The journal file is corrupt! Error in " "internal format.\n"); fclose(fp); return 0; } - if (tolower(count) == from_spot) { + if (tolower(count) == ctx->from_spot) { fclose(fp); return 1; } diff --git a/FICS/gamedb.h b/FICS/gamedb.h index dbb0bb6..2d0edc8 100644 --- a/FICS/gamedb.h +++ b/FICS/gamedb.h @@ -187,8 +187,7 @@ extern int game_remove(int); extern int game_save(int); extern int game_zero(int); extern int got_attr_value(int, char *, char *, FILE *, char *); -extern int journal_get_info(int, char, char *, int *, char *, int *, - char *, int *, int *, char *, char *, char *, char *); +extern int journal_get_info(struct JGI_context *, const char *); extern int pgames(int, int, char *); extern int pjournal(int, int, char *); extern void MakeFENpos(int, char *, size_t); |