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
|
|
@ -37,6 +37,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "rogue.h"
|
||||
|
||||
int num_checks; /* times we've gone over in checkout() */
|
||||
|
|
@ -80,9 +81,12 @@ void
|
|||
open_score(void)
|
||||
{
|
||||
#ifdef SCOREFILE
|
||||
fd = open(SCOREFILE, O_RDWR | O_CREAT, 0666 );
|
||||
score_file = fopen(SCOREFILE, "r+");
|
||||
if ((score_file == NULL) && (errno == ENOENT)) {
|
||||
score_file = fopen(SCOREFILE, "w+");
|
||||
}
|
||||
#else
|
||||
fd = -1;
|
||||
score_file = NULL;
|
||||
#endif
|
||||
if (!use_savedir)
|
||||
md_normaluser();
|
||||
|
|
@ -93,9 +97,9 @@ void
|
|||
open_log(void)
|
||||
{
|
||||
#ifdef LOGFILE
|
||||
lfd = open(LOGFILE, O_WRONLY | O_APPEND | O_CREAT, 0666);
|
||||
log_file = fopen(LOGFILE, "a");
|
||||
#else
|
||||
lfd = -1;
|
||||
log_file = NULL;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue