xref: /original-bsd/usr.bin/pascal/eyacc/ey5.c (revision 279692fa)
1 /*
2  * Copyright (c) 1979 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  */
6 
7 #ifndef lint
8 static char sccsid[] = "@(#)ey5.c	5.2 (Berkeley) 09/22/88";
9 #endif not lint
10 
11 /* fake portable I/O routines, for those
12     sites so backward as to not have the
13      port. library */
14 /* munged for standard i/o library: peter and louise 5 may 80 */
15 #include <stdio.h>
16 
17 FILE *cin, *cout;
18 
19 FILE *copen( s, c )
20     char *s;
21     char c;
22   {
23   FILE *f;
24 
25 	  if( c == 'r' ){
26 	    f = fopen( s, "r" );
27   } else  if( c == 'a' ){
28 	    f = fopen( s, "a" );
29 	    fseek( f, 0L, 2 );
30   } else {  /* c == w */
31 	    f = fopen( s, "w" );
32   }
33 
34   return( f );
35   }
36 
37 cflush(x) FILE *x; { /* fake! sets file to x */
38   fflush( cout );
39   cout = x;
40   }
41 
42 cclose(i) FILE *i; {
43   fclose(i);
44   }
45 
46 cexit(i){
47   fflush( cout );
48   if ( i != 0 ) {
49     abort();
50   }
51   exit(i);
52   }
53