char *cp;
char *pathname;
-#if defined(_WIN32)
- _fmode = _O_BINARY;
-#endif
-
if ((pathname = safe_getcwd()) == NULL) {
printf("Can't get current path!\n");
exit(-1);
char buf[256];
sprintf(buf, "%s/src/make.src", pathname);
- if ((fp = fopen(buf, "w")) == NULL) {
+ if ((fp = fopen(buf, "wb")) == NULL) {
printf("Cannot open %s for writing, exiting.\n", buf);
exit(-1);
}
FILE *fp;
printf("Writing %s\n", filename);
- if ((fp = fopen(filename, "w")) == NULL) {
+ if ((fp = fopen(filename, "wb")) == NULL) {
printf("Cannot open %s for writing, exiting.\n", filename);
exit(-1);
}
FILE *fp;
printf("Writing %s\n", filename);
- if ((fp = fopen(filename, "wt")) == NULL) {
+ if ((fp = fopen(filename, "w")) == NULL) {
printf("Cannot open %s for writing, exiting.\n", filename);
exit(-1);
}
}
printf("Writing %s\n", filename);
- if ((fp = fopen(filename, "w")) == NULL) {
+ if ((fp = fopen(filename, "wb")) == NULL) {
printf("Cannot open %s for writing, exiting.\n", filename);
exit(-1);
}
name = "TOP";
_snprintf(filename, sizeof(filename) - 1, "%s\\%s", infodir, name);
- fp = fopen(filename, "r");
+ fp = fopen(filename, "rb");
if (fp == NULL) {
/* may be a "partial" request. */
HANDLE hDir;
}
_snprintf(filename, sizeof(filename), "%s/%s",
infodir, last);
- fp = fopen(filename, "r");
+ fp = fopen(filename, "rb");
if (fp == NULL) {
pr("Error reading info file for %s\n", name);
logerror("Cannot open for \"%s\" info file (%s)",
(fData.dwFileAttributes == FILE_ATTRIBUTE_READONLY))) {
_snprintf(filename, sizeof(filename), "%s\\%s", infodir,
fData.cFileName);
- fp = fopen(filename, "r");
+ fp = fopen(filename, "rb");
alreadyhit = 0;
nll = nlhl = 0;
if (fp != NULL) {
else
minites = atol(player->argp[1]) * 60;
time(&now);
- if ((fp = fopen(timestampfil, "r+")) == NULL) {
+ if ((fp = fopen(timestampfil, "rb+")) == NULL) {
logerror("Unable to edit timestamp file.");
} else {
rewind(fp);
clear_telegram_is_new(player->cnum);
}
- if ((telfp = fopen(mbox, "r+")) == 0) {
+ if ((telfp = fopen(mbox, "rb+")) == 0) {
logerror("telegram file %s", mbox);
return RET_FAIL;
}
/* Here, we just re-open the file for "w" only,
and that will wipe the file clean automatically */
(void)fclose(telfp);
- telfp = fopen((char *)mbox, "w");
+ telfp = fopen((char *)mbox, "wb");
}
}
}
pr("Writing empty no-login message.\n");
}
- fptr = fopen(msgfilepath, "w");
+ fptr = fopen(msgfilepath, "wb");
if (fptr == NULL) {
pr("Something went wrong opening the message file.\n");
logerror("Could not open message file (%s).\n", msgfilepath);
struct mob_acc_globals timestamps;
if (opt_MOB_ACCESS) {
- if ((fp = fopen(timestampfil, "r")) == NULL)
+ if ((fp = fopen(timestampfil, "rb")) == NULL)
logerror("Unable to open timestamp file.");
else {
rewind(fp);
static int block;
int size;
+#if defined(_WIN32)
+ mode |= O_BINARY;
+#endif
if (ef_check(type) < 0)
return 0;
ep = &empfile[type];
if ((p = strchr(cbuf, '\n')) != 0)
*p = 0;
(void)sprintf(buf1, "%s %s\n", cbuf, buf);
-#if defined(_WIN32)
- if ((logf = open(logfile, O_WRONLY | O_CREAT | O_APPEND | O_TEXT, 0666)) < 0)
-#else
if ((logf = open(logfile, O_WRONLY | O_CREAT | O_APPEND, 0666)) < 0)
-#endif
return;
(void)write(logf, buf1, strlen(buf1));
(void)close(logf);
fixup_files();
return 0;
}
- if ((fp = fopen(file, "rt")) == NULL) {
+ if ((fp = fopen(file, "r")) == NULL) {
fprintf(stderr, "Can't open %s for reading (%s)\n",
file, strerror(errno));
return -1;
if (player->god)
return 0;
- if ((down_fp = fopen(downfil, "r")) == NULL)
+ if ((down_fp = fopen(downfil, "rb")) == NULL)
return 0;
if (fread((void *)&tgm, sizeof(tgm), 1, down_fp) != 1) {
logerror("bad header on login message (downfil)");
struct telstr tgm;
char buf[MAXTELSIZE];
- if ((motd_fp = fopen(motdfil, "r")) == NULL)
+ if ((motd_fp = fopen(motdfil, "rb")) == NULL)
{
if (errno == ENOENT)
return RET_OK;
char host[256];
char user[256];
- if ((fp = fopen(file, "rt")) == NULL) {
+ if ((fp = fopen(file, "r")) == NULL) {
/*logerror("Cannot find file %s", file); */
return 0;
}
(np->nat_stat & STAT_SANCT) == 0)) {
return -1;
}
+#if !defined(_WIN32)
if ((fd = open(box, O_WRONLY | O_APPEND, 0)) < 0) {
+#else
+ if ((fd = open(box, O_WRONLY | O_APPEND | O_BINARY, 0)) < 0) {
+#endif
logerror("telegram 'open' of %s (#%d) failed", box, to);
return -1;
}
old = now - days(anno_keep_days);
logerror("Deleting annos older than %s", ctime(&old));
- if ((annfp = fopen(annfil, "r")) == NULL) {
+ if ((annfp = fopen(annfil, "rb")) == NULL) {
logerror("can't open telegram file %s for reading", annfil);
return;
}
sprintf(tmp_filename, "%s.tmp", annfil);
- if ((tmpfp = fopen(tmp_filename, "w")) == NULL) {
+ if ((tmpfp = fopen(tmp_filename, "wb")) == NULL) {
logerror("can't open telegram file %s for writing",
tmp_filename);
if (fclose(annfp) != 0)
int op;
s_char tbuf[256];
-#if defined(_WIN32)
- _fmode = _O_BINARY;
-#endif
-
mainpid = getpid();
#if defined(_WIN32)
while (1) {
time(&now);
/* logerror("Updating timestamp file at %s", ctime(&now));*/
- if ((fp = fopen(timestampfil, "r+")) == NULL) {
+ if ((fp = fopen(timestampfil, "rb+")) == NULL) {
logerror("Unable to edit timestamp file.");
continue;
}
mobility */
time(&now);
- if ((fp = fopen(timestampfil, "r+")) == NULL) {
+ if ((fp = fopen(timestampfil, "rb+")) == NULL) {
logerror("Unable to edit timestamp file.");
/* FIXME safe to continue? */
} else {
char tbuf[512];
int i = 0;
-#if defined(_WIN32)
- _fmode = _O_BINARY;
-#endif
-
rnd_seed = time(NULL);
while ((opt = getopt(argc, argv, "ae:ioqs:R:")) != EOF) {
{
int i;
- sect_fptr = fopen(empfile[EF_SECTOR].file, "w");
+ sect_fptr = fopen(empfile[EF_SECTOR].file, "wb");
if (sect_fptr == NULL) {
perror(empfile[EF_SECTOR].file);
return -1;
char *config_file = NULL;
int force = 0;
-#if defined(_WIN32)
- _fmode = _O_BINARY;
-#endif
-
while ((opt = getopt(argc, argv, "e:f")) != EOF) {
switch (opt) {
case 'e':