From 205a50d8ee2cea54b3a0baeb47dc06a50ff917cd Mon Sep 17 00:00:00 2001 From: David Given Date: Mon, 18 Jul 2022 19:36:44 +0200 Subject: [PATCH] Add more binary mode flags. --- util/amisc/abmodules.c | 2 +- util/amisc/aslod.c | 2 +- util/grind/do_comm.c | 4 ++-- util/grind/rd.c | 4 ++-- util/int/core.c | 2 +- util/int/read.c | 2 +- util/int/tally.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/util/amisc/abmodules.c b/util/amisc/abmodules.c index b77c7e96b..6a711ad9f 100644 --- a/util/amisc/abmodules.c +++ b/util/amisc/abmodules.c @@ -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; diff --git a/util/amisc/aslod.c b/util/amisc/aslod.c index 6fb115bf9..850c805f1 100644 --- a/util/amisc/aslod.c +++ b/util/amisc/aslod.c @@ -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]; diff --git a/util/grind/do_comm.c b/util/grind/do_comm.c index 926359b8e..a5aa42f91 100644 --- a/util/grind/do_comm.c +++ b/util/grind/do_comm.c @@ -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; diff --git a/util/grind/rd.c b/util/grind/rd.c index 13085b55b..301cfe68c 100644 --- a/util/grind/rd.c +++ b/util/grind/rd.c @@ -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; } diff --git a/util/int/core.c b/util/int/core.c index b9ced3645..f62b1ae2d 100644 --- a/util/int/core.c +++ b/util/int/core.c @@ -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; diff --git a/util/int/read.c b/util/int/read.c index f699c26df..9ee970e25 100644 --- a/util/int/read.c +++ b/util/int/read.c @@ -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); } diff --git a/util/int/tally.c b/util/int/tally.c index f59562478..be8054d86 100644 --- a/util/int/tally.c +++ b/util/int/tally.c @@ -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;