source: trunk/third/gcc/libf2c/libI77/ftell_.c @ 18477

Revision 18477, 897 bytes checked in by ghudson, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18476, which included commits to RCS files with non-trunk default branches.
Line 
1#include "config.h"
2#include "f2c.h"
3#include "fio.h"
4
5 static FILE *
6#ifdef KR_headers
7unit_chk(Unit, who) integer Unit; char *who;
8#else
9unit_chk(integer Unit, char *who)
10#endif
11{
12        if (Unit >= MXUNIT || Unit < 0)
13                f__fatal(101, who);
14        return f__units[Unit].ufd;
15        }
16
17 integer
18#ifdef KR_headers
19G77_ftell_0 (Unit) integer *Unit;
20#else
21G77_ftell_0 (integer *Unit)
22#endif
23{
24        FILE *f;
25        return (f = unit_chk(*Unit, "ftell")) ? (integer) FTELL(f) : -1L;
26        }
27
28 integer
29#ifdef KR_headers
30G77_fseek_0 (Unit, offset, xwhence) integer *Unit, *offset, *xwhence;
31#else
32G77_fseek_0 (integer *Unit, integer *offset, integer *xwhence)
33#endif
34{
35        FILE *f;
36        int w = (int)*xwhence;
37#ifdef SEEK_SET
38        static int wohin[3] = { SEEK_SET, SEEK_CUR, SEEK_END };
39#endif
40        if (w < 0 || w > 2)
41                w = 0;
42#ifdef SEEK_SET
43        w = wohin[w];
44#endif
45        return  !(f = unit_chk(*Unit, "fseek"))
46                || FSEEK(f, (off_t) *offset, w) ? 1 : 0;
47        }
Note: See TracBrowser for help on using the repository browser.