1: /* 2: char id_ftell[] = "@(#)ftell_.c 1.2"; 3: * 4: * return current file position 5: * 6: * calling sequence: 7: * integer curpos, ftell 8: * curpos = ftell(lunit) 9: * where: 10: * lunit is an open logical unit 11: * curpos will be the current offset in bytes from the start of the 12: * file associated with that logical unit 13: * or a (negative) system error code. 14: */ 15: 16: #include "../libI77/fiodefs.h" 17: #include <sys/types.h> 18: 19: extern unit units[]; 20: 21: off_t ftell_(lu) 22: ftnint *lu; 23: { 24: if (*lu < 0 || *lu >= MXUNIT) 25: return(-(off_t)(errno=F_ERUNIT)); 26: if (!units[*lu].ufd) 27: return(-(off_t)(errno=F_ERNOPEN)); 28: return((off_t) ftell(units[*lu].ufd)); 29: }