|
|
1.1 root 1: /*
2: char id_fseek[] = "@(#)fseek_.c 1.2";
3: *
4: * position a file associated with a fortran logical unit
5: *
6: * calling sequence:
7: * ierror = fseek(lunit, ioff, ifrom)
8: * where:
9: * lunit is an open logical unit
10: * ioff is an offset in bytes relative to the position specified by ifrom
11: * ifrom - 0 means 'beginning of the file'
12: * - 1 means 'the current position'
13: * - 2 means 'the end of the file'
14: * ierror will be 0 if successful, a system error code otherwise.
15: */
16:
17: #include <stdio.h>
18: #include "../libI77/f_errno.h"
19: #include "../libI77/fiodefs.h"
20:
21: extern unit units[];
22:
23: long fseek_(lu, off, from)
24: long *lu, *off, *from;
25: {
26: if (*lu < 0 || *lu >= MXUNIT)
27: return((long)(errno=F_ERUNIT));
28: if (*from < 0 || *from > 2)
29: return((long)(errno=F_ERARG));
30: if (!units[*lu].ufd)
31: return((long)(errno=F_ERNOPEN));
32: if (fseek(units[*lu].ufd, *off, (int)*from) < 0)
33: return((long)errno);
34: return(0L);
35: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.