OSDN Git Service

* Previous contents of gcc/f/runtime moved into toplevel
[pf3gnuchains/gcc-fork.git] / libf2c / libI77 / sfe.c
1 /* sequential formatted external common routines*/
2 #include "f2c.h"
3 #include "fio.h"
4
5 extern char *f__fmtbuf;
6
7 integer e_rsfe(Void)
8 {       int n;
9         f__init = 1;
10         n=en_fio();
11         if (f__cf == stdout)
12                 fflush(stdout);
13         else if (f__cf == stderr)
14                 fflush(stderr);
15         f__fmtbuf=NULL;
16         return(n);
17 }
18 #ifdef KR_headers
19 c_sfe(a) cilist *a; /* check */
20 #else
21 c_sfe(cilist *a) /* check */
22 #endif
23 {       unit *p;
24         if(a->ciunit >= MXUNIT || a->ciunit<0)
25                 err(a->cierr,101,"startio");
26         p = &f__units[a->ciunit];
27         if(p->ufd==NULL && fk_open(SEQ,FMT,a->ciunit)) err(a->cierr,114,"sfe");
28         if(!p->ufmt) err(a->cierr,102,"sfe");
29         return(0);
30 }
31 integer e_wsfe(Void)
32 {
33 #ifdef ALWAYS_FLUSH
34         int n;
35         f__init = 1;
36         n = en_fio();
37         f__fmtbuf=NULL;
38         if (!n && fflush(f__cf))
39                 err(f__elist->cierr, errno, "write end");
40         return n;
41 #else
42         return(e_rsfe());
43 #endif
44 }