Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / dos / internalseek.c
blobd49c00ad1de4c5589be0626534ba9ad088282be8
1 /*
2 Copyright © 2002, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #undef SDEBUG
7 #undef DEBUG
8 #define DEBUG 0
9 #include <aros/debug.h>
11 #include <proto/dos.h>
12 #include "dos_intern.h"
14 LONG InternalSeek
16 struct FileHandle *fh,
17 LONG position,
18 LONG mode,
19 struct DosLibrary *DOSBase
22 AROS_LIBBASE_EXT_DECL( struct DosLibrary *, DOSBase )
24 /* Get pointer to I/O request. Use stackspace for now. */
25 struct IOFileSys iofs;
27 /* Make sure the input parameters are sane. */
28 ASSERT_VALID_PTR( fh );
29 ASSERT
31 mode == OFFSET_BEGINNING
32 || mode == OFFSET_END
33 || mode == OFFSET_CURRENT
36 /* Prepare I/O request. */
37 InitIOFS( &iofs, FSA_SEEK, DOSBase );
39 iofs.IOFS.io_Device = fh->fh_Device;
40 iofs.IOFS.io_Unit = fh->fh_Unit;
42 iofs.io_Union.io_SEEK.io_Offset = (QUAD)position;
43 iofs.io_Union.io_SEEK.io_SeekMode = mode;
45 /* Send the request. */
46 DosDoIO( &iofs.IOFS );
48 if( iofs.io_DosError )
50 SetIoErr( iofs.io_DosError );
51 return -1;
53 else
54 return (LONG) iofs.io_Union.io_SEEK.io_Offset;