Commit | Line | Data |
---|---|---|
a58c9769 KM |
1 | /* Copyright (c) 1979 Regents of the University of California */ |
2 | ||
492cc5d3 | 3 | static char sccsid[] = "@(#)RESET.c 1.2 %G%"; |
a58c9769 KM |
4 | |
5 | #include "h00vars.h" | |
6 | #include "h01errs.h" | |
7 | ||
8 | RESET(filep, name, maxnamlen, datasize) | |
9 | ||
10 | register struct iorec *filep; | |
11 | char *name; | |
492cc5d3 KM |
12 | long maxnamlen; |
13 | long datasize; | |
a58c9769 KM |
14 | { |
15 | if (name == NULL && filep == INPUT && filep->fname[0] == '\0') { | |
16 | if (rewind(filep->fbuf)) { | |
17 | ERROR(ESEEK, filep->pfname); | |
18 | return; | |
19 | } | |
20 | filep->funit &= ~(EOFF | EOLN); | |
21 | filep->funit |= SYNC; | |
22 | return; | |
23 | } | |
24 | filep = GETNAME(filep, name, maxnamlen, datasize); | |
25 | filep->fbuf = fopen(filep->fname, "r"); | |
26 | if (filep->fbuf == NULL) { | |
27 | if (filep->funit & TEMP) { | |
28 | filep->funit |= (EOFF | SYNC | FREAD); | |
29 | return; | |
30 | } | |
31 | ERROR(EOPEN, filep->pfname); | |
32 | return; | |
33 | } | |
34 | filep->funit |= (SYNC | FREAD); | |
35 | if (filep->fblk > PREDEF) { | |
36 | setbuf(filep->fbuf, &filep->buf[0]); | |
37 | } | |
38 | } |