xref: /original-bsd/usr.bin/f77/libU77/ftell_.c (revision 014fe330)
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	"../libI77/f_errno.h"
18 
19 extern unit units[];
20 
21 long ftell_(lu)
22 long *lu;
23 {
24 	if (*lu < 0 || *lu >= MXUNIT)
25 		return(-(long)(errno=F_ERUNIT));
26 	if (!units[*lu].ufd)
27 		return(-(long)(errno=F_ERNOPEN));
28 	return(ftell(units[*lu].ufd));
29 }
30