Skip to content

Commit

Permalink
in rg, freopen instead of stdin l-value
Browse files Browse the repository at this point in the history
because stdin (and stdout and stderr) is specified to be a macro, and
therefore, assignment as an l-value might not be portable.

This changeset is motivated as part of work to support gr1c on Windows.
  • Loading branch information
slivingston committed Mar 26, 2020
1 parent 043e72e commit 9ac957a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/rg_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ extern anode_t *synthesize_reachgame_BDD( DdManager *manager,
int main( int argc, char **argv )
{
FILE *fp;
FILE *stdin_backup = NULL;
byte run_option = RG_MODE_SYNTHESIS;
bool help_flag = False;
bool ptdump_flag = False;
Expand Down Expand Up @@ -212,13 +211,11 @@ int main( int argc, char **argv )
/* If filename for specification given at command-line, then use
it. Else, read from stdin. */
if (input_index > 0) {
fp = fopen( argv[input_index], "r" );
fp = freopen( argv[input_index], "r", stdin );
if (fp == NULL) {
perror( __FILE__ ", fopen" );
return -1;
}
stdin_backup = stdin;
stdin = fp;
}

/* Parse the specification. */
Expand All @@ -229,9 +226,6 @@ int main( int argc, char **argv )
return 2;
if (verbose)
logprint( "Done." );
if (stdin_backup != NULL) {
stdin = stdin_backup;
}

if (spc.num_sgoals > 1) {
fprintf( stderr,
Expand Down

0 comments on commit 9ac957a

Please sign in to comment.