xref: /csrg-svn/lib/libc/stdio/fwalk.c (revision 61180)
146111Sbostic /*-
2*61180Sbostic  * Copyright (c) 1990, 1993
3*61180Sbostic  *	The Regents of the University of California.  All rights reserved.
446111Sbostic  *
546111Sbostic  * This code is derived from software contributed to Berkeley by
646111Sbostic  * Chris Torek.
746111Sbostic  *
846111Sbostic  * %sccs.include.redist.c%
946111Sbostic  */
1046111Sbostic 
1146111Sbostic #if defined(LIBC_SCCS) && !defined(lint)
12*61180Sbostic static char sccsid[] = "@(#)fwalk.c	8.1 (Berkeley) 06/04/93";
1346111Sbostic #endif /* LIBC_SCCS and not lint */
1446111Sbostic 
1546611Sbostic #include <errno.h>
1646111Sbostic #include <stdio.h>
1746111Sbostic #include "local.h"
1846111Sbostic #include "glue.h"
1946111Sbostic 
2046111Sbostic _fwalk(function)
2146111Sbostic 	register int (*function)();
2246111Sbostic {
2346111Sbostic 	register FILE *fp;
2446111Sbostic 	register int n, ret;
2546111Sbostic 	register struct glue *g;
2646111Sbostic 
2746111Sbostic 	ret = 0;
2846111Sbostic 	for (g = &__sglue; g != NULL; g = g->next)
2946111Sbostic 		for (fp = g->iobs, n = g->niobs; --n >= 0; fp++)
3046111Sbostic 			if (fp->_flags != 0)
3146111Sbostic 				ret |= (*function)(fp);
3246111Sbostic 	return (ret);
3346111Sbostic }
34