xref: /original-bsd/lib/libc/stdio/fwalk.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1990, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Chris Torek.
7  *
8  * %sccs.include.redist.c%
9  */
10 
11 #if defined(LIBC_SCCS) && !defined(lint)
12 static char sccsid[] = "@(#)fwalk.c	8.1 (Berkeley) 06/04/93";
13 #endif /* LIBC_SCCS and not lint */
14 
15 #include <errno.h>
16 #include <stdio.h>
17 #include "local.h"
18 #include "glue.h"
19 
20 _fwalk(function)
21 	register int (*function)();
22 {
23 	register FILE *fp;
24 	register int n, ret;
25 	register struct glue *g;
26 
27 	ret = 0;
28 	for (g = &__sglue; g != NULL; g = g->next)
29 		for (fp = g->iobs, n = g->niobs; --n >= 0; fp++)
30 			if (fp->_flags != 0)
31 				ret |= (*function)(fp);
32 	return (ret);
33 }
34