1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LSTDIO/FWALK.C Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,43 @@
1.4 +/* FWALK.C
1.5 + *
1.6 + * Portions Copyright (c) 1990-1999 Nokia Corporation and/or its subsidiary(-ies).
1.7 + * All rights reserved.
1.8 + */
1.9 +
1.10 +/* No user fns here. Pesch 15apr92. */
1.11 +
1.12 +/*
1.13 + * Copyright (c) 1990 The Regents of the University of California.
1.14 + * All rights reserved.
1.15 + *
1.16 + * Redistribution and use in source and binary forms are permitted
1.17 + * provided that the above copyright notice and this paragraph are
1.18 + * duplicated in all such forms and that any documentation,
1.19 + * advertising materials, and other materials related to such
1.20 + * distribution and use acknowledge that the software was developed
1.21 + * by the University of California, Berkeley. The name of the
1.22 + * University may not be used to endorse or promote products derived
1.23 + * from this software without specific prior written permission.
1.24 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1.25 + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1.26 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1.27 + */
1.28 +
1.29 +#include <stdio_r.h>
1.30 +#include <stdlib_r.h>
1.31 +#include <errno.h>
1.32 +#include "LOCAL.H"
1.33 +
1.34 +int
1.35 +_fwalk (struct _reent *ptr, register int (*function) (FILE *))
1.36 +{
1.37 + register FILE *fp;
1.38 + register int n, ret = 0;
1.39 + register struct _glue *g;
1.40 +
1.41 + for (g = &ptr->__sglue; g != NULL; g = g->_next)
1.42 + for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++)
1.43 + if (fp->_flags != 0)
1.44 + ret |= (*function) (fp);
1.45 + return ret;
1.46 +}