freopen() appears to be problematic on OSX; as it's only ever used to rewind
files, replace with rewind().
This commit is contained in:
		
							parent
							
								
									1dfafe070c
								
							
						
					
					
						commit
						63fa647bc9
					
				
					 3 changed files with 3 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -155,7 +155,6 @@ void	 emit4(long);
 | 
			
		|||
void	 emitx(valu_t, int);
 | 
			
		||||
void     emitf(int size, int negative);
 | 
			
		||||
void	 emitstr(int);
 | 
			
		||||
void	 ffreopen(char *, FILE *);
 | 
			
		||||
FILE	*ffcreat(char *);
 | 
			
		||||
FILE	*fftemp(char *, char *);
 | 
			
		||||
void	 yyerror(const char *);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -399,7 +399,7 @@ pass_23(int n)
 | 
			
		|||
#ifdef LISTING
 | 
			
		||||
	listmode >>= 3;
 | 
			
		||||
	if (listmode & 4)
 | 
			
		||||
		ffreopen(listpath, listfile);
 | 
			
		||||
		rewind(listfile);
 | 
			
		||||
	listeoln = 1;
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef THREE_PASS
 | 
			
		||||
| 
						 | 
				
			
			@ -438,7 +438,7 @@ pass_23(int n)
 | 
			
		|||
#ifndef ASLD
 | 
			
		||||
	newmodule(modulename);
 | 
			
		||||
#endif /* ASLD */
 | 
			
		||||
	ffreopen(temppath, tempfile);
 | 
			
		||||
	rewind(tempfile);
 | 
			
		||||
	yyparse();
 | 
			
		||||
	commfinish();
 | 
			
		||||
	machfinish(n);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -389,17 +389,11 @@ void emitf(int size, int negative)
 | 
			
		|||
 | 
			
		||||
/* ---------- Error checked file I/O  ---------- */
 | 
			
		||||
 | 
			
		||||
void ffreopen(char* s, FILE* f)
 | 
			
		||||
{
 | 
			
		||||
	if (freopen(s, "r", f) == NULL)
 | 
			
		||||
		fatal("can't reopen %s: %s", s, strerror(errno));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FILE* ffcreat(char* s)
 | 
			
		||||
{
 | 
			
		||||
	FILE* f;
 | 
			
		||||
 | 
			
		||||
	if ((f = fopen(s, "w")) == NULL)
 | 
			
		||||
	if ((f = fopen(s, "w+")) == NULL)
 | 
			
		||||
		fatal("can't create %s", s);
 | 
			
		||||
	return (f);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue