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

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