(main,mobility_check,upda,turn,rea,mobupdate,ef_open,logerror,
emp_config,gamedown,show_motd,match_user,typed_wu, delete_old_announcements) [_WIN32]: switch the default file mode to binary to match POSIX. Remove the now unneccessary ifdef for the open/fopen. Add text mode for user files (econfig/auth).
This commit is contained in:
parent
f6e78f4589
commit
1a8488bc45
13 changed files with 14 additions and 65 deletions
|
@ -61,11 +61,7 @@ mobupdate(void)
|
|||
else
|
||||
minites = atol(player->argp[1]) * 60;
|
||||
time(&now);
|
||||
#if !defined(_WIN32)
|
||||
if ((fp = fopen(timestampfil, "r+")) == NULL) {
|
||||
#else
|
||||
if ((fp = fopen(timestampfil, "r+b")) == NULL) {
|
||||
#endif
|
||||
logerror("Unable to edit timestamp file.");
|
||||
} else {
|
||||
rewind(fp);
|
||||
|
|
|
@ -100,11 +100,7 @@ rea(void)
|
|||
clear_telegram_is_new(player->cnum);
|
||||
}
|
||||
|
||||
#if !defined(_WIN32)
|
||||
if ((telfp = fopen(mbox, "r+")) == 0) {
|
||||
#else
|
||||
if ((telfp = fopen(mbox, "r+b")) == 0) {
|
||||
#endif
|
||||
logerror("telegram file %s", mbox);
|
||||
return RET_FAIL;
|
||||
}
|
||||
|
@ -208,11 +204,7 @@ rea(void)
|
|||
/* Here, we just re-open the file for "w" only,
|
||||
and that will wipe the file clean automatically */
|
||||
(void)fclose(telfp);
|
||||
#if !defined(_WIN32)
|
||||
telfp = fopen((char *)mbox, "w");
|
||||
#else
|
||||
telfp = fopen((char *)mbox, "wb");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,11 +95,7 @@ turn(void)
|
|||
pr("Writing empty no-login message.\n");
|
||||
}
|
||||
|
||||
#if !defined(_WIN32)
|
||||
fd = open(msgfilepath, O_RDWR | O_CREAT | O_TRUNC, 0660);
|
||||
#else
|
||||
fd = open(msgfilepath, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0660);
|
||||
#endif
|
||||
if (fd == -1) {
|
||||
pr("Something went wrong opening the message file.\n");
|
||||
logerror("Could not open message file (%s).\n", msgfilepath);
|
||||
|
|
|
@ -51,13 +51,9 @@ upda(void)
|
|||
struct mob_acc_globals timestamps;
|
||||
|
||||
if (opt_MOB_ACCESS) {
|
||||
#if !defined(_WIN32)
|
||||
if ((fp = fopen(timestampfil, "r")) == NULL) {
|
||||
#else
|
||||
if ((fp = fopen(timestampfil, "rb")) == NULL) {
|
||||
#endif
|
||||
if ((fp = fopen(timestampfil, "r")) == NULL)
|
||||
logerror("Unable to open timestamp file.");
|
||||
} else {
|
||||
else {
|
||||
rewind(fp);
|
||||
fread(×tamps, sizeof(timestamps), 1, fp);
|
||||
fclose(fp);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue