Last change
on this file since 8aad29e was 8973acd, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
No more warnings in libcio.
|
-
Property mode
set to
100644
|
File size:
993 bytes
|
Rev | Line | |
---|
[f40a309] | 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 |
|
---|
[b28a12e] | 8 | #include "ram.h"
|
---|
[e225e77] | 9 |
|
---|
[f40a309] | 10 | /*
|
---|
| 11 | =============================================================================
|
---|
| 12 | fseek(fp, pos, mode) -- position file 'fp' at 'pos' in mode 'mode'.
|
---|
| 13 | =============================================================================
|
---|
| 14 | */
|
---|
| 15 |
|
---|
[7258c6a] | 16 | int16_t fseek(FILE *fp, int32_t pos, int16_t mode)
|
---|
[f40a309] | 17 | {
|
---|
[8973acd] | 18 | register int32_t lr;
|
---|
[f40a309] | 19 |
|
---|
| 20 | if (fp->_flags & _DIRTY) {
|
---|
| 21 |
|
---|
| 22 | if (flush_(fp, -1))
|
---|
| 23 | return(EOF);
|
---|
| 24 |
|
---|
| 25 | } else {
|
---|
| 26 |
|
---|
| 27 | if (mode EQ 1 AND fp->_bp)
|
---|
[7258c6a] | 28 | pos -= (int32_t)fp->_bend - (int32_t)fp->_bp;
|
---|
[f40a309] | 29 | }
|
---|
| 30 |
|
---|
| 31 | fp->_bp = fp->_bend = NULL;
|
---|
[8973acd] | 32 | fp->_flags = (uint8_t)(fp->_flags & ~_EOF);
|
---|
[f40a309] | 33 |
|
---|
| 34 | lr = lseek(fp->_unit, pos, mode);
|
---|
| 35 |
|
---|
[df097bf] | 36 | if (((struct fcb *)chantab[fp->_unit].c_arg)->modefl & FC_EOF)
|
---|
[f40a309] | 37 | fp->_flags |= _EOF;
|
---|
| 38 |
|
---|
| 39 | if (lr < 0)
|
---|
| 40 | return(EOF);
|
---|
| 41 |
|
---|
| 42 | return(0);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
[6262b5c] | 45 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.