aboutsummaryrefslogtreecommitdiffstats
path: root/scoretbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'scoretbl.c')
-rw-r--r--scoretbl.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/scoretbl.c b/scoretbl.c
index 0b7e877..fb57489 100644
--- a/scoretbl.c
+++ b/scoretbl.c
@@ -173,8 +173,7 @@ static char *quote(const unsigned char *i)
* kind of sane way to use the stdio library with sockets, we have to abstract
* out the I/O function that is allowed to access this. Puke.
*/
-void highscore_parse(void *f, char (*mygets)(char *, int, void *),
- uint8_t upload)
+void highscore_parse(FILE *f, uint8_t upload)
{
char line[MAXLINE], pname[MAXLINE];
uint64_t gameid;
@@ -183,7 +182,7 @@ void highscore_parse(void *f, char (*mygets)(char *, int, void *),
int lvl;
unsigned char *pptr;
- while ( mygets(line, MAXLINE, f) ) {
+ while ( fgets(line, MAXLINE, f) ) {
if ( !strchr(line, '\n') )
return; /* Something bogus here... */
@@ -207,19 +206,19 @@ void highscore_parse(void *f, char (*mygets)(char *, int, void *),
/*
* Write out a high score file; return 0 on success, -1 on failure
*/
-int highscore_write(void *f, int (*myputs)(char *, void *), uint8_t leave)
+int highscore_write(FILE *f, uint8_t leave)
{
char buffer[MAXLINE];
int i, j;
- myputs("VC 1.0\n", f); /* Version C 1.0 */
+ fputs("VC 1.0\n", f); /* Version C 1.0 */
for ( i = 0 ; i < MAX_BEST ; i++ ) {
if ( bests.total[i].score ) {
sprintf(buffer, "TS %" PRIx64 " %" PRId64 " %d %s\n",
bests.total[i].gameid, bests.total[i].score,
bests.total[i].endlvl+1, quote(bests.total[i].player));
- if ( myputs(buffer, f) == EOF )
+ if ( fputs(buffer, f) == EOF )
return -1;
bests.total[i].upload &= leave;
}
@@ -231,7 +230,7 @@ int highscore_write(void *f, int (*myputs)(char *, void *), uint8_t leave)
sprintf(buffer, "LS %" PRIx64 " %d %" PRId64 "\n",
bests.level[i].score[j].gameid,
i+1, bests.level[i].score[j].score);
- if ( myputs(buffer, f) == EOF )
+ if ( fputs(buffer, f) == EOF )
return -1;
bests.level[i].score[j].upload &= leave;
}
@@ -240,7 +239,7 @@ int highscore_write(void *f, int (*myputs)(char *, void *), uint8_t leave)
sprintf(buffer, "LT %" PRIx64 " %d %" PRId32 "\n",
bests.level[i].time_ms[j].gameid,
i+1, bests.level[i].time_ms[j].time_ms);
- if ( myputs(buffer, f) == EOF )
+ if ( fputs(buffer, f) == EOF )
return -1;
bests.level[i].time_ms[j].upload &= leave;
}