More binary mode flag setting.

This commit is contained in:
David Given 2022-07-18 19:29:53 +02:00
parent c573b9bce2
commit 279de30935
4 changed files with 10 additions and 3 deletions

View file

@ -104,7 +104,10 @@ int C_open(char* nm)
*/ */
if (nm == 0) if (nm == 0)
{
C_ofp = STDOUT; /* standard output */ C_ofp = STDOUT; /* standard output */
sys_setbinarymode(stdout);
}
else else
{ {

View file

@ -21,6 +21,7 @@
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include "alloc.h" #include "alloc.h"
#include "system.h"
#include "em_label.h" #include "em_label.h"
#include "em_arith.h" #include "em_arith.h"
#include "em_pseu.h" #include "em_pseu.h"
@ -136,7 +137,10 @@ EXPORT int EM_open(char *filename)
} }
} }
else else
{
fd = stdin; fd = stdin;
sys_setbinarymode(stdin);
}
EM_filename = filename; EM_filename = filename;
init_input(); init_input();

View file

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

View file

@ -228,7 +228,7 @@ int main(int argc, char* argv[])
/* fall through */ /* fall through */
case 2: /* Input file specified. */ case 2: /* Input file specified. */
input = fopen(argv[1], "r"); input = fopen(argv[1], "rb");
if (!input) if (!input)
fatal("unable to open input file."); fatal("unable to open input file.");
break; break;