X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2F_PDCLIB%2Fcloseall.c;fp=functions%2F_PDCLIB%2Fcloseall.c;h=3523f8c0fe5013f34f625abbd0146ff9627e25df;hb=29510491be6e3e0b95872920c371024ed444c1e5;hp=0000000000000000000000000000000000000000;hpb=b406087285dda97f2666a7f52f66b14582ed937b;p=pdclib diff --git a/functions/_PDCLIB/closeall.c b/functions/_PDCLIB/closeall.c new file mode 100644 index 0000000..3523f8c --- /dev/null +++ b/functions/_PDCLIB/closeall.c @@ -0,0 +1,35 @@ +/* $Id$ */ + +/* _PDCLIB_closeall( void ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +extern struct _PDCLIB_file_t * _PDCLIB_filelist; + +void _PDCLIB_closeall( void ) +{ + struct _PDCLIB_file_t * stream = _PDCLIB_filelist; + struct _PDCLIB_file_t * next; + while ( stream != NULL ) + { + next = stream->next; + fclose( stream ); + stream = next; + } +} + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + TESTCASE( NO_TESTDRIVER ); + return TEST_RESULTS; +} + +#endif +