home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <exec/nodes.h>
- #include <exec/lists.h>
-
- struct filenode
- {
- struct MinNode node; /* not for stdin, stdout, stderr */
- FILE FILE;
- };
-
- extern struct MinList __filelist;
- extern void __chkabort(void);
- extern int __fflush(FILE *stream);
-
- int fflush(FILE *stream) /* fflush one or all files */
- {
- int retval;
- struct MinNode *node,*nextnode;
- __chkabort();
- retval=0;
- node=__filelist.mlh_Head;
- if(stream!=NULL)
- return __fflush(stream);
- if(__fflush(stdout))
- retval=EOF;
- if(__fflush(stderr))
- retval=EOF;
- while((nextnode=node->mln_Succ)!=NULL)
- { if(__fflush(&((struct filenode *)node)->FILE))
- retval=EOF;
- node=nextnode; }
- return retval;
- }
-