sl@0
|
1 |
/* FWALK.C
|
sl@0
|
2 |
*
|
sl@0
|
3 |
* Portions Copyright (c) 1990-1999 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
4 |
* All rights reserved.
|
sl@0
|
5 |
*/
|
sl@0
|
6 |
|
sl@0
|
7 |
/* No user fns here. Pesch 15apr92. */
|
sl@0
|
8 |
|
sl@0
|
9 |
/*
|
sl@0
|
10 |
* Copyright (c) 1990 The Regents of the University of California.
|
sl@0
|
11 |
* All rights reserved.
|
sl@0
|
12 |
*
|
sl@0
|
13 |
* Redistribution and use in source and binary forms are permitted
|
sl@0
|
14 |
* provided that the above copyright notice and this paragraph are
|
sl@0
|
15 |
* duplicated in all such forms and that any documentation,
|
sl@0
|
16 |
* advertising materials, and other materials related to such
|
sl@0
|
17 |
* distribution and use acknowledge that the software was developed
|
sl@0
|
18 |
* by the University of California, Berkeley. The name of the
|
sl@0
|
19 |
* University may not be used to endorse or promote products derived
|
sl@0
|
20 |
* from this software without specific prior written permission.
|
sl@0
|
21 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
sl@0
|
22 |
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
sl@0
|
23 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
|
sl@0
|
26 |
#include <stdio_r.h>
|
sl@0
|
27 |
#include <stdlib_r.h>
|
sl@0
|
28 |
#include <errno.h>
|
sl@0
|
29 |
#include "LOCAL.H"
|
sl@0
|
30 |
|
sl@0
|
31 |
int
|
sl@0
|
32 |
_fwalk (struct _reent *ptr, register int (*function) (FILE *))
|
sl@0
|
33 |
{
|
sl@0
|
34 |
register FILE *fp;
|
sl@0
|
35 |
register int n, ret = 0;
|
sl@0
|
36 |
register struct _glue *g;
|
sl@0
|
37 |
|
sl@0
|
38 |
for (g = &ptr->__sglue; g != NULL; g = g->_next)
|
sl@0
|
39 |
for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++)
|
sl@0
|
40 |
if (fp->_flags != 0)
|
sl@0
|
41 |
ret |= (*function) (fp);
|
sl@0
|
42 |
return ret;
|
sl@0
|
43 |
}
|