blob: 8e5b825326df947c6d1c062eaf68262e7df48228 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#include "f2c.h"
#include "fio.h"
static FILE *
#ifdef KR_headers
unit_chk(unit, who) integer unit; char *who;
#else
unit_chk(integer unit, char *who)
#endif
{
if (unit >= MXUNIT || unit < 0)
f__fatal(101, who);
return f__units[unit].ufd;
}
integer
#ifdef KR_headers
ftell_(unit) integer *unit;
#else
ftell_(integer *unit)
#endif
{
FILE *f;
return (f = unit_chk(*unit, "ftell")) ? ftell(f) : -1L;
}
int
#ifdef KR_headers
fseek_(unit, offset, xwhence) integer *unit, *offset, *xwhence;
#else
fseek_(integer *unit, integer *offset, integer *xwhence)
#endif
{
int whence;
FILE *f;
switch (*xwhence) {
default:
errno = EINVAL;
return 1;
case 0:
whence = SEEK_SET;
break;
case 1:
whence = SEEK_CUR;
break;
case 2:
whence = SEEK_END;
break;
}
return !(f = unit_chk(*unit, "fseek"))
|| fseek(f, *offset, whence) ? 1 : 0;
}
|