1: /* 2: * Copyright (c) 1980 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: * 6: * @(#)ftell_.c 5.1 6/7/85 7: */ 8: 9: /* 10: * return current file position 11: * 12: * calling sequence: 13: * integer curpos, ftell 14: * curpos = ftell(lunit) 15: * where: 16: * lunit is an open logical unit 17: * curpos will be the current offset in bytes from the start of the 18: * file associated with that logical unit 19: * or a (negative) system error code. 20: */ 21: 22: #include "../libI77/fiodefs.h" 23: #include "../libI77/f_errno.h" 24: 25: extern unit units[]; 26: 27: long ftell_(lu) 28: long *lu; 29: { 30: if (*lu < 0 || *lu >= MXUNIT) 31: return(-(long)(errno=F_ERUNIT)); 32: if (!units[*lu].ufd) 33: return(-(long)(errno=F_ERNOPEN)); 34: return(ftell(units[*lu].ufd)); 35: }