Add more binary mode flags.

This commit is contained in:
David Given 2022-07-18 19:36:44 +02:00
parent 279de30935
commit 205a50d8ee
7 changed files with 9 additions and 9 deletions

View file

@ -151,7 +151,7 @@ int main(int argc, char* const argv[])
switch (opt)
{
case 'o':
outputfp = fopen(optarg, "w");
outputfp = fopen(optarg, "wb");
if (!outputfp)
fatal("cannot open output file: %s", strerror(errno));
break;

View file

@ -221,7 +221,7 @@ int main(int argc, char* argv[])
break;
case 3: /* Both input and output files specified. */
output = fopen(argv[2], "w");
output = fopen(argv[2], "wb");
if (!output)
fatal("unable to open output file.");
outputfile = argv[2];

View file

@ -435,7 +435,7 @@ do_file(p)
}
return;
}
if ((f = fopen(p->t_args[0]->t_str, "r")) == NULL) {
if ((f = fopen(p->t_args[0]->t_str, "rb")) == NULL) {
error("could not open %s", p->t_args[0]->t_str);
return;
}
@ -810,7 +810,7 @@ do_source(p)
FILE *old_db_in = db_in;
p = p->t_args[0];
if ((db_in = fopen(p->t_str, "r")) == NULL) {
if ((db_in = fopen(p->t_str, "rb")) == NULL) {
db_in = old_db_in;
error("could not open %s", p->t_str);
return;

View file

@ -108,7 +108,7 @@ int
rd_open(f)
char *f;
{
if ((inf = fopen(f, "r")) == NULL) return 0;
if ((inf = fopen(f, "rb")) == NULL) return 0;
return 1;
}
@ -346,7 +346,7 @@ int
rd_open(f)
char *f;
{
if ((inf = fopen(f, "r")) == NULL) return 0;
if ((inf = fopen(f, "rb")) == NULL) return 0;
return 1;
}

View file

@ -14,7 +14,7 @@ void core_dump(void)
{
FILE *core_file;
core_file = fopen("int.core", "w");
core_file = fopen("int.core", "wb");
if (!core_file) {
/* no point in giving a fatal error again! */
return;

View file

@ -61,7 +61,7 @@ PRIVATE long rd_int(size);
void rd_open(char *fname)
{ /* Open loadfile */
if ((load_fp = fopen(fname, "r")) == NULL)
if ((load_fp = fopen(fname, "rb")) == NULL)
{
fatal("Cannot open loadfile '%s'", fname);
}

View file

@ -115,7 +115,7 @@ void out_tally(void)
if (!*hook)
return;
tally_fp = fopen("int.tally", "w");
tally_fp = fopen("int.tally", "wb");
if (!tally_fp)
return;