2 Copyright © 2002-2008, The AROS Development Team. All rights reserved.
9 #include <aros/debug.h>
11 #include <proto/dos.h>
12 #include "dos_intern.h"
16 struct FileHandle
*fh
,
19 struct DosLibrary
*DOSBase
23 /* Get pointer to I/O request. Use stackspace for now. */
24 struct IOFileSys iofs
;
26 /* Make sure the input parameters are sane. */
27 ASSERT_VALID_PTR( fh
);
30 mode
== OFFSET_BEGINNING
32 || mode
== OFFSET_CURRENT
35 /* Prepare I/O request. */
36 InitIOFS( &iofs
, FSA_SEEK
, DOSBase
);
38 iofs
.IOFS
.io_Device
= fh
->fh_Device
;
39 iofs
.IOFS
.io_Unit
= fh
->fh_Unit
;
41 iofs
.io_Union
.io_SEEK
.io_Offset
= (QUAD
)position
;
42 iofs
.io_Union
.io_SEEK
.io_SeekMode
= mode
;
44 /* send the request, with error reporting */
47 } while (iofs
.io_DosError
!= 0
48 && !ErrorReport(iofs
.io_DosError
, REPORT_STREAM
, (IPTR
)fh
, NULL
));
50 SetIoErr(iofs
.io_DosError
);
52 return iofs
.io_DosError
== 0 ? (LONG
) iofs
.io_Union
.io_SEEK
.io_Offset
: -1;