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)
{
C_ofp = STDOUT; /* standard output */
sys_setbinarymode(stdout);
}
else
{

View file

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

View file

@ -691,14 +691,14 @@ 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];
/* fall through */
case 2: /* Input file specified. */
input = fopen(argv[1], "r");
input = fopen(argv[1], "rb");
if (!input)
fatal("unable to open input file.");
break;

View file

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