xref: /original-bsd/usr.bin/f77/libI77/endfile.c (revision 53787e02)
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  *	@(#)endfile.c	5.1	06/07/85
7  */
8 
9 /*
10  * endfile
11  */
12 
13 #include "fio.h"
14 
15 static char	endf[]	= "endfile";
16 
17 f_end (a)
18 alist	*a;
19 {
20 	unit	*b;
21 
22 	lfname = NULL;
23 	elist = NO;
24 	errflag = a->aerr;
25 	lunit = a->aunit;
26 	if (not_legal(lunit))
27 		err (errflag, F_ERUNIT, endf)
28 	b = &units[lunit];
29 	if (!b->ufd)
30 		err (errflag, F_ERNOPEN, endf)
31 	if (b->uend)
32 		return(0);
33 	lfname = b->ufnm;
34 	b->uend = YES;
35 	return ( t_runc (b, errflag, endf) );
36 }
37