|
|
1.1 root 1: /* Copyright (c) 1979 Regents of the University of California */
2:
3: static char sccsid[] = "@(#)READE.c 1.1 10/29/80";
4:
5: #include "h00vars.h"
6: #include "h01errs.h"
7:
8: READE(curfile, name)
9:
10: register struct iorec *curfile;
11: char *name;
12: {
13: long data;
14:
15: register short *sptr;
16: register int len;
17: register int nextlen;
18: register int cnt;
19: char *cp;
20: char namebuf[NAMSIZ];
21:
22: if (curfile->funit & FWRITE) {
23: ERROR(EREADIT, curfile->pfname);
24: return;
25: }
26: UNSYNC(curfile);
27: if (fscanf(curfile->fbuf,
28: "%*[ \t\n]%74[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]",
29: namebuf) == 0) {
30: ERROR(ENUMNTFD, namebuf);
31: return;
32: }
33: curfile->funit |= SYNC;
34: for (len = 0; len < NAMSIZ && namebuf[len]; len++)
35: /* void */;
36: len++;
37: sptr = (short *)name;
38: cnt = *sptr++;
39: cp = name + sizeof (short) + *sptr;
40: do {
41: nextlen = *sptr++;
42: nextlen = *sptr - nextlen;
43: if (nextlen == len && RELEQ(len, namebuf, cp)) {
44: return *((short *) name) - cnt;
45: }
46: cp += nextlen;
47: } while (--cnt);
48: ERROR(ENUMNTFD, namebuf);
49: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.