BSD 4 development
[unix-history] / usr / src / cmd / eyacc / ey5.c
CommitLineData
c7755dd8
BJ
1/* (c) 1979 Regents of the University of California */
2/* fake portable I/O routines, for those
3 sites so backward as to not have the
4 port. library */
5/* munged for portable i/o library: peter and louise 5 may 80 */
6#include <stdio.h>
7
8FILE *cin, *cout;
9
10FILE *copen( s, c )
11 char *s;
12 char c;
13 {
14 FILE *f;
15
16 if( c == 'r' ){
17 f = fopen( s, "r" );
18 } else if( c == 'a' ){
19 f = fopen( s, "a" );
20 fseek( f, 0L, 2 );
21 } else { /* c == w */
22 f = fopen( s, "w" );
23 }
24
25 return( f );
26 }
27
28cflush(x) FILE *x; { /* fake! sets file to x */
29 fflush( cout );
30 cout = x;
31 }
32
33system(){
34 error( "The function \"system\" is called" );
35 }
36
37cclose(i) FILE *i; {
38 fclose(i);
39 }
40
41cexit(i){
42 fflush( cout );
43 if ( i != 0 ) {
44 abort();
45 }
46 exit(i);
47 }