xref: /original-bsd/usr.bin/f77/libI77/endfile.c (revision 93152bbe)
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[] = "@(#)endfile.c	5.3 (Berkeley) 04/12/91";
10 #endif /* not lint */
11 
12 /*
13  * endfile
14  */
15 
16 #include "fio.h"
17 
18 static char	endf[]	= "endfile";
19 
20 f_end (a)
21 alist	*a;
22 {
23 	unit	*b;
24 	int n;
25 
26 	lfname = NULL;
27 	elist = NO;
28 	errflag = a->aerr;
29 	lunit = a->aunit;
30 	if (not_legal(lunit))
31 		err (errflag, F_ERUNIT, endf)
32 	b = &units[lunit];
33 	if(!b->ufd && (n = fk_open(READ, SEQ, FMT, (ftnint)lunit)) )
34 		err(errflag, n, endf);
35 	if (b->uend)
36 		return(0);
37 	lfname = b->ufnm;
38 	b->uend = YES;
39 	return ( t_runc (b, errflag, endf) );
40 }
41