2 Copyright © 2002-2007, The AROS Development Team. All rights reserved.
6 #include <exec/types.h>
8 #include <aros/debug.h>
10 #include "dos_intern.h"
12 LONG
InternalFlush( struct FileHandle
*fh
, struct DosLibrary
*DOSBase
)
16 /* Make sure the input parameters are sane. */
17 ASSERT_VALID_PTR( fh
);
18 ASSERT_VALID_PTR( BADDR(fh
->fh_Buf
) );
20 ASSERT(fh
->fh_End
> 0);
21 ASSERT(fh
->fh_Pos
>= 0);
22 ASSERT(fh
->fh_Pos
<= fh
->fh_End
);
24 /* Write the data, in many pieces if the first one isn't enough. */
27 while( position
< fh
->fh_Pos
)
31 size
= Write( MKBADDR(fh
), BADDR(fh
->fh_Buf
) + position
, fh
->fh_Pos
- position
);
33 /* An error happened? No success. */
36 fh
->fh_Flags
&= ~FHF_WRITE
;
44 /* Reset the buffer. */