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:
John "Elwin" Edwards 2017-09-15 19:57:54 -04:00
parent f8d1f422c8
commit c661fd79d4
33 changed files with 426 additions and 439 deletions

View file

@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#ifdef BSD
#include <sys/time.h>
#else
@ -550,11 +551,21 @@ setup(void)
nonl();
}
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");

View file

@ -155,10 +155,10 @@ md_raw_standend(void)
}
int
md_unlink_open_file(char *file, int inf)
md_unlink_open_file(char *file, FILE *inf)
{
#ifdef _WIN32
close(inf);
fclose(inf);
chmod(file, 0600);
return( _unlink(file) );
#else
@ -677,17 +677,6 @@ md_flushinp(void)
#endif
}
extern int scorefd;
extern char score_file[];
void
md_reopen_score(void)
{
if (scorefd > 0)
close(scorefd);
scorefd = open(score_file, O_RDWR | O_CREAT, 0666);
}
/*
Cursor/Keypad Support

View file

@ -497,7 +497,7 @@ get_score(char *optstr, WINDOW *win)
status = get_str(optstr, win);
if (status == NORM && strcmp(old_score_file, optstr))
{
md_reopen_score();
reopen_score();
}
return status;
}

View file

@ -46,9 +46,6 @@ extern struct uwdata wdata, oldwin;
extern char oldtext[WTXTNUM][WTXTLEN];
#endif
extern int scorefd;
extern FILE *logfile;
#ifdef NUMNET
/* Network machines (for mutual score keeping) */
static struct network Network[NUMNET] = {
@ -256,10 +253,8 @@ score(unsigned long amount, int flags, short monst)
register struct sc_ent *scp;
register int i;
register struct sc_ent *sc2;
register int outfd;
register char *killer;
register int prflags = 0;
register int fd;
short upquest, wintype, uplevel, uptype; /* For network updating */
char upsystem[SYSLEN], uplogin[LOGLEN];
char *thissys; /* Holds the name of this system */
@ -290,11 +285,10 @@ score(unsigned long amount, int flags, short monst)
purse = 0; /* Steal all the gold */
/*
* Open file and read list
* Read list
*/
if ((fd = scorefd) < 0) return;
outfd = fd;
if (scoreboard == NULL) return;
#ifndef SYSTEM
thissys = md_gethostname();
@ -347,10 +341,10 @@ score(unsigned long amount, int flags, short monst)
/* Read the score and convert it to a compatible format */
for(i = 0; i < NUMSCORE; i++)
{
encread(top_ten[i].sc_name, NAMELEN, fd);
encread(top_ten[i].sc_system, SYSLEN, fd);
encread(top_ten[i].sc_login, LOGLEN, fd);
encread(scoreline, 100, fd);
encread(top_ten[i].sc_name, NAMELEN, scoreboard);
encread(top_ten[i].sc_system, SYSLEN, scoreboard);
encread(top_ten[i].sc_login, LOGLEN, scoreboard);
encread(scoreline, 100, scoreboard);
sscanf(scoreline, " %lu %hd %hd %hd %hd %hd \n",
&top_ten[i].sc_score, &top_ten[i].sc_flags,
&top_ten[i].sc_level, &top_ten[i].sc_ctype,
@ -383,7 +377,7 @@ score(unsigned long amount, int flags, short monst)
errors++;
if (errors) {
close(outfd);
fclose(scoreboard);
free(compatstr);
return;
}
@ -646,7 +640,7 @@ score(unsigned long amount, int flags, short monst)
}
/* if (prflags == EDITSCORE) endwin();*/ /* End editing windowing */
}
lseek(outfd, 0L, 0);
fseek(scoreboard, 0L, SEEK_SET);
/*
* Update the list file
*/
@ -654,17 +648,17 @@ score(unsigned long amount, int flags, short monst)
for(i = 0; i < NUMSCORE; i++)
{
memset(scoreline,0,100);
encwrite(top_ten[i].sc_name, NAMELEN, outfd);
encwrite(top_ten[i].sc_system, SYSLEN, outfd);
encwrite(top_ten[i].sc_login, LOGLEN, outfd);
encwrite(top_ten[i].sc_name, NAMELEN, scoreboard);
encwrite(top_ten[i].sc_system, SYSLEN, scoreboard);
encwrite(top_ten[i].sc_login, LOGLEN, scoreboard);
sprintf(scoreline, " %lu %hd %hd %hd %hd %hd \n",
top_ten[i].sc_score, top_ten[i].sc_flags,
top_ten[i].sc_level, top_ten[i].sc_ctype,
top_ten[i].sc_monster, top_ten[i].sc_quest);
encwrite(scoreline,100,outfd);
encwrite(scoreline,100,scoreboard);
}
close(outfd);
fclose(scoreboard);
}
/*

View file

@ -80,7 +80,6 @@ int pray_time = 0;
int spell_power = 0;
int turns = 0; /* Number of turns player has taken */
int quest_item = 0; /* Item player is looking for */
int scorefd = -1; /* File descriptor for score file */
int cols = 0; /* number of columns in terminal */
int lines = 0; /* number of lines on the terminal */
char nfloors = -1; /* Number of floors in this dungeon */
@ -134,6 +133,7 @@ bool askme = TRUE;
bool in_shell = FALSE;
bool daytime = TRUE;
bool use_savedir = FALSE;
FILE *scoreboard = NULL; /* Score file */
FILE *logfile = NULL;
LEVTYPE levtype; /* type of level i'm on */

View file

@ -1208,8 +1208,8 @@ void eat(void);
void eat_gold(struct object *obj);
int effect(struct thing *att, struct thing *def, struct object *weap,
bool thrown, bool see_att, bool see_def);
int encread(char *start, unsigned int size, int inf);
int encwrite(char *start, unsigned int size, int outf);
int encread(char *start, unsigned int size, FILE *inf);
int encwrite(char *start, unsigned int size, FILE *outf);
void endmsg(void);
void explode(struct thing *tp);
void extinguish(void (*func)());
@ -1314,6 +1314,7 @@ void raise_level(void);
short randmonster(bool wander, bool no_unique);
void read_scroll(int which, int flag, bool is_scroll);
int readchar(void);
void reopen_score(void);
void res_charisma(int howmuch);
void res_constitution(int howmuch);
void res_dexterity(int howmuch);
@ -1335,7 +1336,7 @@ coord *rndmove(struct thing *who);
int roll(int number, int sides);
void rollwand(void);
struct room *roomin(coord *cp);
int rs_restore_file(int inf);
int rs_restore_file(FILE *inf);
int rs_save_file(FILE *savef);
int runners(int segments);
void runto(struct thing *runner, coord *spot);
@ -1419,12 +1420,11 @@ long md_memused(void);
int md_normaluser(void);
int md_rand(void);
unsigned int md_random_seed(void);
void md_reopen_score(void);
int md_readchar(WINDOW *win);
int md_shellescape(void);
int md_srand(int seed);
int md_unlink(char *file);
int md_unlink_open_file(char *file, int inf);
int md_unlink_open_file(char *file, FILE *inf);
#ifdef CHECKTIME
int checkout();
@ -1504,7 +1504,6 @@ extern int pray_time; /* Number of prayer points/exp level */
extern int spell_power; /* Spell power left at this level */
extern int turns; /* Number of turns player has taken */
extern int quest_item; /* Item hero is looking for */
extern int scorefd; /* File descriptor for score file */
extern int cur_relic[]; /* Current relics */
extern char take; /* Thing the rogue is taking */
extern char prbuf[]; /* Buffer for sprintfs */
@ -1565,6 +1564,7 @@ extern char *spacemsg;
extern char *morestr;
extern char *retstr;
extern FILE *logfile;
extern FILE *scoreboard; /* Score file */
extern LEVTYPE levtype;
extern void (*add_abil[NUMABILITIES])(); /* Functions to change abilities */
extern void (*res_abil[NUMABILITIES])(); /* Functions to change abilities */

View file

@ -34,15 +34,15 @@ extern struct uwdata wdata;
#endif
#if u370 || uts
#define ENCREAD(b,n,fd) read(fd,b,n)
#define ENCWRITE(b,n,fd) write(fd,b,n)
#define ENCREAD(b,n,f) read(md_fileno(f),b,n)
#define ENCWRITE(b,n,f) write(md_fileno(f),b,n)
#endif
#ifndef ENCREAD
#define ENCREAD encread
#define ENCWRITE encwrite
#endif
bool save_file(int savefd);
bool save_file(FILE *savef);
typedef struct stat STAT;
@ -55,7 +55,7 @@ STAT sbuf;
bool
save_game(void)
{
register int savefd;
FILE *savefi = NULL;
register int c;
char buf[LINELEN];
@ -100,18 +100,18 @@ save_game(void)
}
strcpy(file_name, buf);
gotfile:
if ((savefd = open(file_name, O_WRONLY|O_CREAT|O_TRUNC,0666)) < 0)
if ((savefi = fopen(file_name, "w")) == NULL)
{
msg(strerror(errno)); /* fake perror() */
if (use_savedir)
return FALSE;
}
} while (savefd < 0);
} while (savefi == NULL);
/*
* write out encrpyted file (after a stat)
*/
if (save_file(savefd) == FALSE) {
if (save_file(savefi) == FALSE) {
msg("Cannot create save file.");
md_unlink(file_name);
return(FALSE);
@ -126,15 +126,15 @@ gotfile:
void
auto_save(int sig)
{
register int savefd;
FILE *savefi;
register int i;
for (i = 0; i < NSIG; i++)
signal(i, SIG_IGN);
if (file_name[0] != '\0' &&
pstats.s_hpt > 0 &&
(savefd = open(file_name, O_WRONLY|O_CREAT|O_TRUNC, 0600)) >= 0)
save_file(savefd);
(savefi = fopen(file_name, "w")) != NULL)
save_file(savefi);
endwin();
#ifdef PC7300
endhardwin();
@ -146,21 +146,19 @@ auto_save(int sig)
* write the saved game on the file
*/
bool
save_file(int savefd)
save_file(FILE *savef)
{
register unsigned num_to_write, num_written;
FILE *savef;
int ret;
wmove(cw, lines-1, 0);
draw(cw);
lseek(savefd, 0L, 0);
fstat(savefd, &sbuf);
fseek(savef, 0L, SEEK_SET);
stat(file_name, &sbuf);
num_to_write = strlen(version) + 1;
num_written = ENCWRITE(version, num_to_write, savefd);
num_written = ENCWRITE(version, num_to_write, savef);
sprintf(prbuf,"%d x %d\n", LINES, COLS);
ENCWRITE(prbuf,80,savefd);
savef = (FILE *) md_fdopen(savefd,"wb");
ENCWRITE(prbuf,80,savef);
ret = rs_save_file(savef);
fclose(savef);
if (num_to_write == num_written && ret == 0) return(TRUE);
@ -170,7 +168,7 @@ save_file(int savefd)
bool
restore(char *file, char *envp[])
{
register int inf;
FILE *inf;
extern char **environ;
char buf[LINELEN];
STAT sbuf2;
@ -178,7 +176,7 @@ restore(char *file, char *envp[])
if (strcmp(file, "-r") == 0)
file = file_name;
if ((inf = open(file, 0)) < 0)
if ((inf = fopen(file, "r")) == NULL)
{
if (use_savedir && errno == ENOENT)
{
@ -202,7 +200,7 @@ restore(char *file, char *envp[])
ENCREAD(buf, 80, inf);
sscanf(buf, "%d x %d\n", &oldline, &oldcol);
fstat(inf, &sbuf2);
stat(file, &sbuf2);
fflush(stdout);
initscr();
@ -228,7 +226,7 @@ restore(char *file, char *envp[])
if (rs_restore_file(inf) != 0)
{
printf("Cannot restore file\n");
close(inf);
fclose(inf);
return(FALSE);
}
@ -265,7 +263,7 @@ restore(char *file, char *envp[])
* perform an encrypted write
*/
int
encwrite(char *start, unsigned int size, int outf)
encwrite(char *start, unsigned int size, FILE *outf)
{
register char *ep;
register int i = 0;
@ -281,7 +279,7 @@ encwrite(char *start, unsigned int size, int outf)
ep = encstr;
if (i == ENCWBSIZ || size == 0) {
if (write(outf, buf, (unsigned)i) < i)
if (fwrite(buf, 1, (unsigned)i, outf) < i)
return(num_written);
else {
num_written += i;
@ -296,12 +294,12 @@ encwrite(char *start, unsigned int size, int outf)
* perform an encrypted read
*/
int
encread(char *start, unsigned int size, int inf)
encread(char *start, unsigned int size, FILE *inf)
{
register char *ep;
register int read_size;
if ((read_size = read(inf, start, size)) == -1 || read_size == 0)
if ((read_size = fread(start, 1, size, inf)) == 0)
return read_size;
ep = encstr;

View file

@ -75,9 +75,9 @@ static int endian = 0x01020304;
int list_size(struct linked_list *l);
int rs_write_int(FILE *savef, int c);
int rs_read_int(int inf, int *i);
int rs_read_int(FILE *inf, int *i);
int rs_write_object_list(FILE *savef, struct linked_list *l);
int rs_read_object_list(int inf, struct linked_list **list);
int rs_read_object_list(FILE *inf, struct linked_list **list);
int
rs_write(FILE *savef, void *ptr, size_t size)
@ -85,14 +85,14 @@ rs_write(FILE *savef, void *ptr, size_t size)
if (write_error)
return(WRITESTAT);
if (encwrite(ptr, size, md_fileno(savef)) != size)
if (encwrite(ptr, size, savef) != size)
write_error = 1;
return(WRITESTAT);
}
int
rs_read(int inf, void *ptr, size_t size)
rs_read(FILE *inf, void *ptr, size_t size)
{
if (read_error || format_error)
return(READSTAT);
@ -115,7 +115,7 @@ rs_write_uchar(FILE *savef, unsigned char c)
}
int
rs_read_uchar(int inf, unsigned char *c)
rs_read_uchar(FILE *inf, unsigned char *c)
{
if (read_error || format_error)
return(READSTAT);
@ -137,7 +137,7 @@ rs_write_char(FILE *savef, char c)
}
int
rs_read_char(int inf, char *c)
rs_read_char(FILE *inf, char *c)
{
if (read_error || format_error)
return(READSTAT);
@ -160,7 +160,7 @@ rs_write_chars(FILE *savef, char *c, int count)
}
int
rs_read_chars(int inf, char *i, int count)
rs_read_chars(FILE *inf, char *i, int count)
{
int value = 0;
@ -201,7 +201,7 @@ rs_write_int(FILE *savef, int c)
}
int
rs_read_int(int inf, int *i)
rs_read_int(FILE *inf, int *i)
{
unsigned char bytes[4];
int input = 0;
@ -244,7 +244,7 @@ rs_write_ints(FILE *savef, int *c, int count)
}
int
rs_read_ints(int inf, int *i, int count)
rs_read_ints(FILE *inf, int *i, int count)
{
int n, value;
@ -277,7 +277,7 @@ rs_write_boolean(FILE *savef, bool c)
}
int
rs_read_boolean(int inf, bool *i)
rs_read_boolean(FILE *inf, bool *i)
{
unsigned char buf = 0;
@ -309,7 +309,7 @@ rs_write_booleans(FILE *savef, bool *c, int count)
}
int
rs_read_booleans(int inf, bool *i, int count)
rs_read_booleans(FILE *inf, bool *i, int count)
{
int n = 0, value = 0;
@ -350,7 +350,7 @@ rs_write_short(FILE *savef, short c)
}
int
rs_read_short(int inf, short *i)
rs_read_short(FILE *inf, short *i)
{
unsigned char bytes[2];
short input;
@ -391,7 +391,7 @@ rs_write_shorts(FILE *savef, short *c, int count)
}
int
rs_read_shorts(int inf, short *i, int count)
rs_read_shorts(FILE *inf, short *i, int count)
{
int n = 0, value = 0;
@ -432,7 +432,7 @@ rs_write_ushort(FILE *savef, unsigned short c)
}
int
rs_read_ushort(int inf, unsigned short *i)
rs_read_ushort(FILE *inf, unsigned short *i)
{
unsigned char bytes[2];
unsigned short input;
@ -479,7 +479,7 @@ rs_write_uint(FILE *savef, unsigned int c)
}
int
rs_read_uint(int inf, unsigned int *i)
rs_read_uint(FILE *inf, unsigned int *i)
{
unsigned char bytes[4];
int input;
@ -535,7 +535,7 @@ rs_write_long(FILE *savef, long c)
}
int
rs_read_long(int inf, long *i)
rs_read_long(FILE *inf, long *i)
{
unsigned char bytes[4];
long input;
@ -580,7 +580,7 @@ rs_write_longs(FILE *savef, long *c, int count)
}
int
rs_read_longs(int inf, long *i, int count)
rs_read_longs(FILE *inf, long *i, int count)
{
int n = 0, value = 0;
@ -630,7 +630,7 @@ rs_write_ulong(FILE *savef, unsigned long c)
}
int
rs_read_ulong(int inf, unsigned long *i)
rs_read_ulong(FILE *inf, unsigned long *i)
{
unsigned char bytes[4];
unsigned long input;
@ -676,7 +676,7 @@ rs_write_ulongs(FILE *savef, unsigned long *c, int count)
}
int
rs_read_ulongs(int inf, unsigned long *i, int count)
rs_read_ulongs(FILE *inf, unsigned long *i, int count)
{
int n = 0, value = 0;
@ -707,7 +707,7 @@ rs_write_marker(FILE *savef, int id)
}
int
rs_read_marker(int inf, int id)
rs_read_marker(FILE *inf, int id)
{
int nid;
@ -742,7 +742,7 @@ rs_write_string(FILE *savef, char *s)
}
int
rs_read_string(int inf, char *s, int max)
rs_read_string(FILE *inf, char *s, int max)
{
int len = 0;
@ -760,7 +760,7 @@ rs_read_string(int inf, char *s, int max)
}
int
rs_read_new_string(int inf, char **s)
rs_read_new_string(FILE *inf, char **s)
{
int len=0;
char *buf=0;
@ -805,7 +805,7 @@ rs_write_strings(FILE *savef, char *s[], int count)
}
int
rs_read_strings(int inf, char **s, int count, int max)
rs_read_strings(FILE *inf, char **s, int count, int max)
{
int n = 0;
int value = 0;
@ -826,7 +826,7 @@ rs_read_strings(int inf, char **s, int count, int max)
}
int
rs_read_new_strings(int inf, char **s, int count)
rs_read_new_strings(FILE *inf, char **s, int count)
{
int n = 0;
int value = 0;
@ -862,7 +862,7 @@ rs_write_string_index(FILE *savef, char *master[], int max, const char *str)
}
int
rs_read_string_index(int inf, char *master[], int maxindex, char **str)
rs_read_string_index(FILE *inf, char *master[], int maxindex, char **str)
{
int i;
@ -894,7 +894,7 @@ rs_write_coord(FILE *savef, coord c)
}
int
rs_read_coord(int inf, coord *c)
rs_read_coord(FILE *inf, coord *c)
{
coord in;
@ -929,7 +929,7 @@ rs_write_coord_list(FILE *savef, struct linked_list *l)
}
int
rs_read_coord_list(int inf, struct linked_list **list)
rs_read_coord_list(FILE *inf, struct linked_list **list)
{
int i, cnt;
struct linked_list *l = NULL, *previous = NULL, *head = NULL;
@ -987,7 +987,7 @@ rs_write_window(FILE *savef, WINDOW *win)
}
int
rs_read_window(int inf, WINDOW *win)
rs_read_window(FILE *inf, WINDOW *win)
{
int row,col,maxlines,maxcols,value,width,height;
@ -1075,7 +1075,7 @@ rs_write_levtype(FILE *savef, LEVTYPE c)
}
int
rs_read_levtype(int inf, LEVTYPE *l)
rs_read_levtype(FILE *inf, LEVTYPE *l)
{
int lt;
@ -1120,7 +1120,7 @@ rs_write_stats(FILE *savef, struct stats *s)
}
int
rs_read_stats(int inf, struct stats *s)
rs_read_stats(FILE *inf, struct stats *s)
{
if (read_error || format_error)
return(READSTAT);
@ -1165,7 +1165,7 @@ rs_write_magic_items(FILE *savef, struct magic_item *i, int count)
}
int
rs_read_magic_items(int inf, struct magic_item *mi, int count)
rs_read_magic_items(FILE *inf, struct magic_item *mi, int count)
{
int n;
int value;
@ -1210,7 +1210,7 @@ rs_write_scrolls(FILE *savef)
}
int
rs_read_scrolls(int inf)
rs_read_scrolls(FILE *inf)
{
int i;
@ -1246,7 +1246,7 @@ rs_write_potions(FILE *savef)
}
int
rs_read_potions(int inf)
rs_read_potions(FILE *inf)
{
int i;
@ -1282,7 +1282,7 @@ rs_write_rings(FILE *savef)
}
int
rs_read_rings(int inf)
rs_read_rings(FILE *inf)
{
int i;
@ -1317,7 +1317,7 @@ rs_write_misc(FILE *savef)
}
int
rs_read_misc(int inf)
rs_read_misc(FILE *inf)
{
int i;
@ -1364,7 +1364,7 @@ rs_write_sticks(FILE *savef)
}
int
rs_read_sticks(int inf)
rs_read_sticks(FILE *inf)
{
int i = 0, j = 0, list = 0;
@ -1588,7 +1588,7 @@ rs_write_daemons(FILE *savef, struct delayed_action *d_list, int count)
}
int
rs_read_daemons(int inf, struct delayed_action *d_list, int count)
rs_read_daemons(FILE *inf, struct delayed_action *d_list, int count)
{
int i = 0;
int func = 0;
@ -1774,7 +1774,7 @@ rs_write_room(FILE *savef, struct room *r)
}
int
rs_read_room(int inf, struct room *r)
rs_read_room(FILE *inf, struct room *r)
{
int value = 0, n = 0, i = 0, index = 0, id = 0;
struct linked_list *fires=NULL, *item = NULL;
@ -1831,7 +1831,7 @@ rs_write_rooms(FILE *savef, struct room r[], int count)
}
int
rs_read_rooms(int inf, struct room *r, int count)
rs_read_rooms(FILE *inf, struct room *r, int count)
{
int value = 0, n = 0;
@ -1867,7 +1867,7 @@ rs_write_room_reference(FILE *savef, struct room *rp)
}
int
rs_read_room_reference(int inf, struct room **rp)
rs_read_room_reference(FILE *inf, struct room **rp)
{
int i;
@ -1911,7 +1911,7 @@ rs_write_door_reference(FILE *savef, coord *exit)
}
int
rs_read_door_reference(int inf, coord **exit)
rs_read_door_reference(FILE *inf, coord **exit)
{
int i, idx;
@ -1945,7 +1945,7 @@ rs_write_traps(FILE *savef, struct trap *trap,int count)
}
int
rs_read_traps(int inf, struct trap *trap, int count)
rs_read_traps(FILE *inf, struct trap *trap, int count)
{
int id = 0, value = 0, n = 0;
@ -1992,7 +1992,7 @@ rs_write_monsters(FILE *savef, struct monster *m, int count)
}
int
rs_read_monsters(int inf, struct monster *m, int count)
rs_read_monsters(FILE *inf, struct monster *m, int count)
{
int value = 0, n = 0;
@ -2044,7 +2044,7 @@ rs_write_object(FILE *savef, struct object *o)
}
int
rs_read_object(int inf, struct object *o)
rs_read_object(FILE *inf, struct object *o)
{
if (read_error || format_error)
return(READSTAT);
@ -2085,7 +2085,7 @@ rs_write_object_list(FILE *savef, struct linked_list *l)
}
int
rs_read_object_list(int inf, struct linked_list **list)
rs_read_object_list(FILE *inf, struct linked_list **list)
{
int i, cnt;
struct linked_list *l = NULL, *previous = NULL, *head = NULL;
@ -2137,7 +2137,7 @@ rs_write_object_reference(FILE *savef, struct linked_list *list, struct object *
}
int
rs_read_object_reference(int inf, struct linked_list *list, struct object **item)
rs_read_object_reference(FILE *inf, struct linked_list *list, struct object **item)
{
int i;
@ -2280,7 +2280,7 @@ rs_write_thing(FILE *savef, struct thing *t)
}
int
rs_read_thing(int inf, struct thing *t)
rs_read_thing(FILE *inf, struct thing *t)
{
int listid = 0, index = -1;
@ -2395,7 +2395,7 @@ rs_write_thing_list(FILE *savef, struct linked_list *l)
}
int
rs_read_thing_list(int inf, struct linked_list **list)
rs_read_thing_list(FILE *inf, struct linked_list **list)
{
int i, cnt;
struct linked_list *l = NULL, *previous = NULL, *head = NULL;
@ -2462,7 +2462,7 @@ rs_write_thing_reference(FILE *savef, struct linked_list *list, struct thing *it
}
int
rs_read_thing_reference(int inf, struct linked_list *list, struct thing **item)
rs_read_thing_reference(FILE *inf, struct linked_list *list, struct thing **item)
{
int i;
@ -2494,7 +2494,7 @@ rs_write_thing_references(FILE *savef, struct linked_list *list, struct thing *i
}
int
rs_read_thing_references(int inf, struct linked_list *list, struct thing *items[], int count)
rs_read_thing_references(FILE *inf, struct linked_list *list, struct thing *items[], int count)
{
int i;
@ -2635,7 +2635,7 @@ rs_save_file(FILE *savef)
}
int
rs_restore_file(int inf)
rs_restore_file(FILE *inf)
{
int i;