home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
TELECOM
/
rn_4_3_blars.lzh
/
cheat.c
< prev
next >
Wrap
Text File
|
1990-08-22
|
3KB
|
153 lines
/* $Header: cheat.c,v 4.3.2.2 89/11/27 01:30:18 sob Locked $
*
* $Log: cheat.c,v $
* Revision 4.3.2.2 89/11/27 01:30:18 sob
* Altered NNTP code per ideas suggested by Bela Lubkin
* <filbo@gorn.santa-cruz.ca.us>
*
* Revision 4.3.2.1 89/11/26 22:54:21 sob
* Added RRN support
*
* Revision 4.3 85/05/01 11:36:46 lwall
* Baseline for release with 4.3bsd.
*
*/
#include "EXTERN.h"
#include "common.h"
#include "intrp.h"
#include "search.h"
#include "ng.h"
#include "bits.h"
#include "artio.h"
#include "term.h"
#include "artsrch.h"
#include "head.h"
#include "INTERN.h"
#include "cheat.h"
/* see what we can do while they are reading */
#ifdef PENDING
# ifdef ARTSEARCH
COMPEX srchcompex; /* compiled regex for searchahead */
# endif
#endif
void
cheat_init()
{
;
}
#ifdef PENDING
void
look_ahead()
{
#ifdef ARTSEARCH
register char *h, *s;
#ifdef DEBUGGING
if (debug && srchahead) {
printf("(%ld)",(long)srchahead);
fflush(stdout);
}
#endif
if (srchahead && srchahead < art) { /* in ^N mode? */
char *pattern;
pattern = buf+1;
strcpy(pattern,": *");
h = pattern + strlen(pattern);
interp(h,(sizeof buf) - (h-buf),"%s");
h[24] = '\0'; /* compensate for notesfiles */
while (*h) {
if (index("\\[.^*$'\"",*h) != Nullch)
*h++ = '.';
else
h++;
}
#ifdef DEBUGGING
if (debug & DEB_SEARCH_AHEAD) {
fputs("(hit CR)",stdout);
fflush(stdout);
gets(buf+128);
printf("\npattern = %s\n",pattern);
}
#endif
if ((s = compile(&srchcompex,pattern,TRUE,TRUE)) != Nullch) {
/* compile regular expression */
printf("\n%s\n",s);
srchahead = 0;
}
if (srchahead) {
srchahead = art;
for (;;) {
srchahead++; /* go forward one article */
if (srchahead > lastart) { /* out of articles? */
#ifdef DEBUGGING
if (debug)
fputs("(not found)",stdout);
#endif
break;
}
if (!was_read(srchahead) &&
wanted(&srchcompex,srchahead,0)) {
/* does the shoe fit? */
#ifdef DEBUGGING
if (debug)
printf("(%ld)",(long)srchahead);
#endif
#ifdef SERVER
nntpopen(srchahead,HEAD);
#else
artopen(srchahead);
#endif
break;
}
if (input_pending())
break;
}
fflush(stdout);
}
}
else
#endif
{
if (art+1 <= lastart)/* how about a pre-fetch? */
#ifdef SERVER
nntpopen(art+1,HEAD); /* look for the next article */
#else
artopen(art+1); /* look for the next article */
#endif
}
}
#endif
/* see what else we can do while they are reading */
void
collect_subjects()
{
#ifdef PENDING
# ifdef CACHESUBJ
ART_NUM oldart = openart;
ART_POS oldartpos;
if (!in_ng || !srchahead)
return;
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);
if (oldart) {
artopen(oldart);
fseek(artfp,oldartpos,0); /* do not screw the pager */
}
# endif
#endif
}