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 "../libI77/fiodefs.h" 18: #include <sys/types.h> 19: 20: extern unit units[]; 21: 22: ftnint fseek_(lu, off, from) 23: ftnint *lu; off_t *off; ftnint *from; 24: { 25: if (*lu < 0 || *lu >= MXUNIT) 26: return((ftnint)(errno=F_ERUNIT)); 27: if (*from < 0 || *from > 2) 28: return((ftnint)(errno=F_ERARG)); 29: if (!units[*lu].ufd) 30: return((ftnint)(errno=F_ERNOPEN)); 31: if (fseek(units[*lu].ufd, (ftnint) *off, (int)*from) < 0) 32: return((ftnint)errno); 33: return((ftnint) 0); 34: }