xref: /original-bsd/usr.bin/f77/libU77/ftell_.c (revision 5133e8a4)
1 /*-
2  * Copyright (c) 1980 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)ftell_.c	5.2 (Berkeley) 04/12/91";
10 #endif /* not lint */
11 
12 /*
13  * return current file position
14  *
15  * calling sequence:
16  *	integer curpos, ftell
17  *	curpos = ftell(lunit)
18  * where:
19  *	lunit is an open logical unit
20  *	curpos will be the current offset in bytes from the start of the
21  *		file associated with that logical unit
22  *		or a (negative) system error code.
23  */
24 
25 #include	"../libI77/fiodefs.h"
26 #include	"../libI77/f_errno.h"
27 
28 extern unit units[];
29 
30 long ftell_(lu)
31 long *lu;
32 {
33 	if (*lu < 0 || *lu >= MXUNIT)
34 		return(-(long)(errno=F_ERUNIT));
35 	if (!units[*lu].ufd)
36 		return(-(long)(errno=F_ERNOPEN));
37 	return(ftell(units[*lu].ufd));
38 }
39