1: /* $Header: cheat.c,v 4.3 85/05/01 11:36:46 lwall Exp $
   2:  *
   3:  * $Log:	cheat.c,v $
   4:  * Revision 4.3  85/05/01  11:36:46  lwall
   5:  * Baseline for release with 4.3bsd.
   6:  *
   7:  */
   8: 
   9: #include "EXTERN.h"
  10: #include "common.h"
  11: #include "intrp.h"
  12: #include "search.h"
  13: #include "ng.h"
  14: #include "bits.h"
  15: #include "artio.h"
  16: #include "term.h"
  17: #include "artsrch.h"
  18: #include "head.h"
  19: #include "INTERN.h"
  20: #include "cheat.h"
  21: 
  22: /* see what we can do while they are reading */
  23: 
  24: #ifdef PENDING
  25: #   ifdef ARTSEARCH
  26:     COMPEX srchcompex;      /* compiled regex for searchahead */
  27: #   endif
  28: #endif
  29: 
  30: void
  31: cheat_init()
  32: {
  33:     ;
  34: }
  35: 
  36: #ifdef PENDING
  37: void
  38: look_ahead()
  39: {
  40: #ifdef ARTSEARCH
  41:     register char *h, *s;
  42: 
  43: #ifdef DEBUGGING
  44:     if (debug && srchahead) {
  45:     printf("(%ld)",(long)srchahead);
  46:     fflush(stdout);
  47:     }
  48: #endif
  49:     if (srchahead && srchahead < art) { /* in ^N mode? */
  50:     char *pattern;
  51: 
  52:     pattern = buf+1;
  53:     strcpy(pattern,": *");
  54:     h = pattern + strlen(pattern);
  55:     interp(h,(sizeof buf) - (h-buf),"%s");
  56:     h[24] = '\0';       /* compensate for notesfiles */
  57:     while (*h) {
  58:         if (index("\\[.^*$'\"",*h) != Nullch)
  59:         *h++ = '.';
  60:         else
  61:         h++;
  62:     }
  63: #ifdef DEBUGGING
  64:     if (debug & DEB_SEARCH_AHEAD) {
  65:         fputs("(hit CR)",stdout);
  66:         fflush(stdout);
  67:         gets(buf+128);
  68:         printf("\npattern = %s\n",pattern);
  69:     }
  70: #endif
  71:     if ((s = compile(&srchcompex,pattern,TRUE,TRUE)) != Nullch) {
  72:                     /* compile regular expression */
  73:         printf("\n%s\n",s);
  74:         srchahead = 0;
  75:     }
  76:     if (srchahead) {
  77:         srchahead = art;
  78:         for (;;) {
  79:         srchahead++;    /* go forward one article */
  80:         if (srchahead > lastart) { /* out of articles? */
  81: #ifdef DEBUGGING
  82:             if (debug)
  83:             fputs("(not found)",stdout);
  84: #endif
  85:             break;
  86:         }
  87:         if (!was_read(srchahead) &&
  88:             wanted(&srchcompex,srchahead,0)) {
  89:                     /* does the shoe fit? */
  90: #ifdef DEBUGGING
  91:             if (debug)
  92:             printf("(%ld)",(long)srchahead);
  93: #endif
  94:             artopen(srchahead);
  95:             break;
  96:         }
  97:         if (input_pending())
  98:             break;
  99:         }
 100:         fflush(stdout);
 101:     }
 102:     }
 103:     else
 104: #endif
 105:     {
 106:     if (art+1 <= lastart)/* how about a pre-fetch? */
 107:         artopen(art+1); /* look for the next article */
 108:     }
 109: }
 110: #endif
 111: 
 112: /* see what else we can do while they are reading */
 113: 
 114: void
 115: collect_subjects()
 116: {
 117: #ifdef PENDING
 118: # ifdef CACHESUBJ
 119:     ART_NUM oldart = openart;
 120:     ART_POS oldartpos;
 121: 
 122:     if (!in_ng || !srchahead)
 123:     return;
 124:     if (oldart)         /* remember where we were in art */
 125:     oldartpos = ftell(artfp);
 126:     if (srchahead >= subj_to_get)
 127:     subj_to_get = srchahead+1;
 128:     while (!input_pending() && subj_to_get <= lastart)
 129:     fetchsubj(subj_to_get++,FALSE,FALSE);
 130:     if (oldart) {
 131:     artopen(oldart);
 132:     fseek(artfp,oldartpos,0);   /* do not screw the pager */
 133:     }
 134: # endif
 135: #endif
 136: }

Defined functions

cheat_init defined in line 30; used 2 times
look_ahead defined in line 37; used 2 times
Last modified: 1987-03-16
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2631
Valid CSS Valid XHTML 1.0 Strict