/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#pragma prototyped2223#include "stdhdr.h"2425#define MAXLOOP 32627int28fcloseall(void)29{30Sfpool_t* p;31Sfpool_t* next;32int n;33int nclose;34int count;35int loop;3637STDIO_INT(0, "fcloseall", int, (void), ())3839for(loop = 0; loop < MAXLOOP; ++loop)40{ nclose = count = 0;41for(p = &_Sfpool; p; p = next)42{ /* find the next legitimate pool */43for(next = p->next; next; next = next->next)44if(next->n_sf > 0)45break;46for(n = 0; n < ((p == &_Sfpool) ? p->n_sf : 1); ++n)47{ count += 1;48if(sfclose(p->sf[n]) >= 0)49nclose += 1;50}51}52if(nclose == count)53break;54}55return 0; /* always return 0 per GNU */56}575859