Use C stdio functions for score files and save files.
Switching from Unix file descriptor operations to C standard FILE* functions will reduce portability problems.
This commit is contained in:
parent
f8d1f422c8
commit
c661fd79d4
33 changed files with 426 additions and 439 deletions
|
|
@ -20,6 +20,7 @@
|
|||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include "mach_dep.h"
|
||||
#include "network.h"
|
||||
#include "rogue.h"
|
||||
|
|
@ -244,11 +245,23 @@ main(int argc, char *argv[], char *envp[])
|
|||
playit();
|
||||
}
|
||||
|
||||
void
|
||||
reopen_score(void)
|
||||
{
|
||||
if (scoreboard != NULL)
|
||||
fclose(scoreboard);
|
||||
scoreboard = fopen(score_file, "r+");
|
||||
if (scoreboard == NULL && errno == ENOENT) {
|
||||
scoreboard = fopen(score_file, "w+");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
open_records(void)
|
||||
{
|
||||
if (scorefd == -1)
|
||||
md_reopen_score();
|
||||
if (scoreboard == NULL)
|
||||
reopen_score();
|
||||
#ifdef LOGFILE
|
||||
if (logfile == NULL)
|
||||
logfile = fopen(LOGFILE, "a");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue