This is Charles Forsyth's version of refer for Plan 9, with a few more
fixes and improvements.  Charles fixed many bugs and deleted half the
source, reducing it from 8,000 to 4,000 lines.


These are the diffs from Charles's source:

diff ./corout.c /usr/geoff/src/cmd/refer/corout.c
17a18
> 			assert(bp->fn != 0);
diff ./deliv1.c /usr/geoff/src/cmd/refer/deliv1.c
26a27
> 		lp = len = 0;
diff ./hunt1.c /usr/geoff/src/cmd/refer/hunt1.c
136c136
< 			fprintf(stderr, "after doquery nfound %d\n", nfound);
---
> 			fprintf(stderr, "after doquery nfound %d\n", drops->n);
diff ./inv3.c /usr/geoff/src/cmd/refer/inv3.c
54d53
< 	return 0;	/* for compiler */
diff ./mkey2.c /usr/geoff/src/cmd/refer/mkey2.c
58c58,59
< 		if (ky[0] != '1' || (ky[1] != '9' && ky[1] != '8') || n != 4) 
---
> 		if (((ky[0] != '1' || (ky[1] != '9' && ky[1] != '8')) &&
> 		     (ky[0] != '2' || ky[1] != '0'))|| n != 4)
diff ./mkey3.c /usr/geoff/src/cmd/refer/mkey3.c
34c34
< 		if (fgets(cbp, 15, f) == NULL)
---
> 		if (fgets(cbp, COMNUM, f) == NULL)
44c44
< static int c_look(char *s, int fl)
---
> static int c_look(char *s, int justlook)
48,49c48
< 	h = hash(s) % (COMTSIZE);
< 	while (cwds[h] != 0) {
---
> 	for (h = hash(s) % COMTSIZE; cwds[h] != 0; h = (h + 1) % COMTSIZE)
52,54c51
< 		h = (h + 1) % (COMTSIZE);
< 	}
< 	if (fl == 0)
---
> 	if (justlook == 0)
diff ./mkfile /usr/geoff/src/cmd/refer/mkfile
17c17
< CFLAGS = -FVw -D_POSIX_SOURCE -D_RESEARCH_SOURCE -D_BSD_EXTENSION
---
> CFLAGS = -FTVw -D_POSIX_SOURCE -D_RESEARCH_SOURCE -D_BSD_EXTENSION
47,52c47,48
< refer0.$O: refer.h def.h err.h error.h inv.h libc.h mkey.h re.h stdio.h
< refer1.$O: refer.h def.h err.h error.h inv.h libc.h mkey.h re.h stdio.h
< refer2.$O: refer.h def.h err.h error.h inv.h libc.h mkey.h re.h stdio.h
< corout.$O: refer.h def.h err.h error.h inv.h libc.h mkey.h re.h stdio.h
< refer4.$O: refer.h def.h err.h error.h inv.h libc.h mkey.h re.h stdio.h
< refer6.$O: refer.h def.h err.h error.h inv.h libc.h mkey.h re.h stdio.h
---
> corout.$O refer0.$O refer1.$O refer2.$O refer4.$O refer6.$O: \
> 	refer.h def.h err.h error.h inv.h libc.h mkey.h re.h stdio.h
diff ./re.h /usr/geoff/src/cmd/refer/re.h
5a6
> #pragma incomplete re_ac
diff ./refer0.c /usr/geoff/src/cmd/refer/refer0.c
39c39
< char	*Ifile = "/dev/stdin";
---
> char	*Ifile = "/fd/0";
diff ./refer2.c /usr/geoff/src/cmd/refer/refer2.c
74c74
< 			*p |= 040;
---
> 			*p = tolower(*p);
94c94,95
< 				if (digs != 4 || (atoi(r) / 100 != 19)) {
---
> 				if (digs != 4 || atoi(r) / 100 != 19 &&
> 				    atoi(r) / 100 != 20) {
144a146
> 			/* fall through */
diff ./refer5.c /usr/geoff/src/cmd/refer/refer5.c
227c227
< 	char	t1[50], *sf;
---
> 	char	t1[LLINE], *sf;	/* LLINE was 50, which was easily overrun */
diff ./refer6.c /usr/geoff/src/cmd/refer/refer6.c
223c223
< 			c &= (~040);
---
> 			c &= ~040;	/* force to upper case */
diff ./refer7.c /usr/geoff/src/cmd/refer/refer7.c
53c53
< 		sprintf(comm, "PATH=/york/bin:/bin:/usr/bin sort -fd %s -o %s", tfile, tfile);
---
> 		sprintf(comm, "/bin/sort -fd %s -o %s", tfile, tfile);
diff ./shell.c /usr/geoff/src/cmd/refer/shell.c
7a8,10
> 
> 	assert(comp != 0);
> 	assert(exch != 0);
