some fixes to accented characters
[tangerine.git] / rom / dos / internalseek.c
blob6aaf8dfaba56c889682956303a688df154e31411
1 /*
2 Copyright © 2002-2008, 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
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 );
28 ASSERT
30 mode == OFFSET_BEGINNING
31 || mode == OFFSET_END
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 */
45 do {
46 DosDoIO(&iofs.IOFS);
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;