/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/


#include	"r64.h"
#include	"r64_types.h"

int
r64_flush(R64_FILE * f)
{
R64_CACHE_ENT * ce;

	for ( ce = f->cache[0].next ; ce != &f->cache[0] ;
			ce = ce->next ) {
		if ( ce->flags&EF_DIRTY )
			if ( _r64_flush(f,ce) < 0 )
				return -1;
	}
	r64_error = E_OK;
	return 0;
}
