/* $Header: cheat.c,v 4.3 85/05/01 11:36:46 lwall Exp $
* Revision 4.3 85/05/01 11:36:46 lwall
* Baseline for release with 4.3bsd.
/* see what we can do while they are reading */
COMPEX srchcompex
; /* compiled regex for searchahead */
if (debug
&& srchahead
) {
printf("(%ld)",(long)srchahead
);
if (srchahead
&& srchahead
< art
) { /* in ^N mode? */
h
= pattern
+ strlen(pattern
);
interp(h
,(sizeof buf
) - (h
-buf
),"%s");
h
[24] = '\0'; /* compensate for notesfiles */
if (index("\\[.^*$'\"",*h
) != Nullch
)
if (debug
& DEB_SEARCH_AHEAD
) {
fputs("(hit CR)",stdout
);
printf("\npattern = %s\n",pattern
);
if ((s
= compile(&srchcompex
,pattern
,TRUE
,TRUE
)) != Nullch
) {
/* compile regular expression */
srchahead
++; /* go forward one article */
if (srchahead
> lastart
) { /* out of articles? */
fputs("(not found)",stdout
);
if (!was_read(srchahead
) &&
wanted(&srchcompex
,srchahead
,0)) {
printf("(%ld)",(long)srchahead
);
if (art
+1 <= lastart
)/* how about a pre-fetch? */
artopen(art
+1); /* look for the next article */
/* see what else we can do while they are reading */
ART_NUM oldart
= openart
;
if (!in_ng
|| !srchahead
)
if (oldart
) /* remember where we were in art */
oldartpos
= ftell(artfp
);
if (srchahead
>= subj_to_get
)
subj_to_get
= srchahead
+1;
while (!input_pending() && subj_to_get
<= lastart
)
fetchsubj(subj_to_get
++,FALSE
,FALSE
);
fseek(artfp
,oldartpos
,0); /* do not screw the pager */