Include the fortran library sources from GCC 3.4.4.
[dragonfly.git] / contrib / gcc-3.4 / libf2c / libI77 / ftell_.c
1 #include "config.h"
2 #include "f2c.h"
3 #include "fio.h"
4
5 static FILE *
6 unit_chk (integer Unit, char *who)
7 {
8   if (Unit >= MXUNIT || Unit < 0)
9     f__fatal (101, who);
10   return f__units[Unit].ufd;
11 }
12
13 integer
14 G77_ftell_0 (integer * Unit)
15 {
16   FILE *f;
17   return (f = unit_chk (*Unit, "ftell")) ? (integer) FTELL (f) : -1L;
18 }
19
20 integer
21 G77_fseek_0 (integer * Unit, integer * offset, integer * xwhence)
22 {
23   FILE *f;
24   int w = (int) *xwhence;
25 #ifdef SEEK_SET
26   static int wohin[3] = { SEEK_SET, SEEK_CUR, SEEK_END };
27 #endif
28   if (w < 0 || w > 2)
29     w = 0;
30 #ifdef SEEK_SET
31   w = wohin[w];
32 #endif
33   return !(f = unit_chk (*Unit, "fseek"))
34     || FSEEK (f, (off_t) * offset, w) ? 1 : 0;
35 }