source: buchla-68k/libcio/fseek.c@ 4aa78b2

Last change on this file since 4aa78b2 was b28a12e, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Zero redundant declarations.

  • Property mode set to 100644
File size: 990 bytes
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 "ram.h"
9
10/*
11 =============================================================================
12 fseek(fp, pos, mode) -- position file 'fp' at 'pos' in mode 'mode'.
13 =============================================================================
14*/
15
16int16_t fseek(FILE *fp, int32_t pos, int16_t mode)
17{
18 register int16_t i, lr;
19 int32_t curpos;
20
21 if (fp->_flags & _DIRTY) {
22
23 if (flush_(fp, -1))
24 return(EOF);
25
26 } else {
27
28 if (mode EQ 1 AND fp->_bp)
29 pos -= (int32_t)fp->_bend - (int32_t)fp->_bp;
30 }
31
32 fp->_bp = fp->_bend = NULL;
33 fp->_flags &= ~_EOF;
34
35 lr = lseek(fp->_unit, pos, mode);
36
37 if (((struct fcb *)chantab[fp->_unit].c_arg)->modefl & FC_EOF)
38 fp->_flags |= _EOF;
39
40 if (lr < 0)
41 return(EOF);
42
43 return(0);
44}
45
46
Note: See TracBrowser for help on using the repository browser.