Last change
on this file since f40d52b was 109c83b, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Compiled full ROM in Hatari.
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /*
|
---|
2 | =============================================================================
|
---|
3 | fseek.c -- perform a seek on a stream file
|
---|
4 | Version 4 -- 1987-10-28 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stdio.h"
|
---|
9 | #include "biosdefs.h"
|
---|
10 | #include "io.h"
|
---|
11 | #include "stddefs.h"
|
---|
12 |
|
---|
13 | /*
|
---|
14 | =============================================================================
|
---|
15 | fseek(fp, pos, mode) -- position file 'fp' at 'pos' in mode 'mode'.
|
---|
16 | =============================================================================
|
---|
17 | */
|
---|
18 |
|
---|
19 | fseek(fp, pos, mode)
|
---|
20 | register FILE *fp;
|
---|
21 | long pos;
|
---|
22 | int mode;
|
---|
23 | {
|
---|
24 | register int i, lr;
|
---|
25 | long curpos, lseek();
|
---|
26 |
|
---|
27 | if (fp->_flags & _DIRTY) {
|
---|
28 |
|
---|
29 | if (flush_(fp, -1))
|
---|
30 | return(EOF);
|
---|
31 |
|
---|
32 | } else {
|
---|
33 |
|
---|
34 | if (mode EQ 1 AND fp->_bp)
|
---|
35 | pos -= (long)fp->_bend - (long)fp->_bp;
|
---|
36 | }
|
---|
37 |
|
---|
38 | fp->_bp = fp->_bend = NULL;
|
---|
39 | fp->_flags &= ~_EOF;
|
---|
40 |
|
---|
41 | lr = lseek(fp->_unit, pos, mode);
|
---|
42 |
|
---|
43 | if (chantab[fp->_unit].c_arg->modefl & FC_EOF)
|
---|
44 | fp->_flags |= _EOF;
|
---|
45 |
|
---|
46 | if (lr < 0)
|
---|
47 | return(EOF);
|
---|
48 |
|
---|
49 | return(0);
|
---|
50 | }
|
---|
51 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.