|
|
1.1 root 1: /* Copyright (c) 1979 Regents of the University of California */
2:
3: static char sccsid[] = "@(#)PCLOSE.c 1.1 10/29/80";
4:
5: #include "h00vars.h"
6: #include "h01errs.h"
7:
8: PCLOSE(level)
9:
10: struct iorec *level;
11: {
12: register struct iorec *next;
13:
14: next = _fchain.fchain;
15: while(next != FILNIL && next->flev <= level) {
16: if (next->fbuf != 0) {
17: if ((next->funit & FDEF) == 0) {
18: fclose(next->fbuf);
19: if (ferror(next->fbuf)) {
20: ERROR(ECLOSE, next->pfname);
21: return;
22: }
23: }
24: if ((next->funit & TEMP) != 0 &&
25: unlink(next->pfname)) {
26: ERROR(EREMOVE, next->pfname);
27: return;
28: }
29: }
30: _actfile[next->fblk] = FILNIL;
31: next = next->fchain;
32: }
33: _fchain.fchain = next;
34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.