1: /* $Header: only.c,v 4.3 85/05/01 11:45:21 lwall Exp $
   2:  *
   3:  * $Log:	only.c,v $
   4:  * Revision 4.3  85/05/01  11:45:21  lwall
   5:  * Baseline for release with 4.3bsd.
   6:  *
   7:  */
   8: 
   9: #include "EXTERN.h"
  10: #include "common.h"
  11: #include "search.h"
  12: #include "util.h"
  13: #include "final.h"
  14: #include "ngsrch.h"
  15: #include "INTERN.h"
  16: #include "only.h"
  17: 
  18: void
  19: only_init()
  20: {
  21:     ;
  22: }
  23: 
  24: void
  25: setngtodo(pat)
  26: char *pat;
  27: {
  28:     char *s;
  29: 
  30: #ifdef ONLY
  31:     if (!*pat)
  32:     return;
  33:     if (maxngtodo < NGMAX) {
  34:     ngtodo[maxngtodo] = savestr(pat);
  35: #ifdef SPEEDOVERMEM
  36: #ifndef lint
  37:     compextodo[maxngtodo] = (COMPEX*)safemalloc(sizeof(COMPEX));
  38: #endif lint
  39:     init_compex(compextodo[maxngtodo]);
  40:     compile(compextodo[maxngtodo],pat,TRUE,TRUE);
  41:     if ((s = ng_comp(compextodo[maxngtodo],pat,TRUE,TRUE)) != Nullch) {
  42:                         /* compile regular expression */
  43:         printf("\n%s\n",s) FLUSH;
  44:         finalize(1);
  45:     }
  46: #endif
  47:     maxngtodo++;
  48:     }
  49: #else
  50:     notincl("o");
  51: #endif
  52: }
  53: 
  54: /* if command line list is non-null, is this newsgroup wanted? */
  55: 
  56: bool
  57: inlist(ngnam)
  58: char *ngnam;
  59: {
  60: #ifdef ONLY
  61:     register int i;
  62: #ifdef SPEEDOVERMEM
  63: 
  64:     if (maxngtodo == 0)
  65:     return TRUE;
  66:     for (i=0; i<maxngtodo; i++) {
  67:     if (execute(compextodo[i],ngnam))
  68:         return TRUE;
  69:     }
  70:     return FALSE;
  71: #else
  72:     COMPEX ilcompex;
  73:     char *s;
  74: 
  75:     if (maxngtodo == 0)
  76:     return TRUE;
  77:     init_compex(&ilcompex);
  78:     for (i=0; i<maxngtodo; i++) {
  79:     if ((s = ng_comp(&ilcompex,ngtodo[i],TRUE,TRUE)) != Nullch) {
  80:                         /* compile regular expression */
  81:         printf("\n%s\n",s) FLUSH;
  82:         finalize(1);
  83:     }
  84: 
  85:     if (execute(&ilcompex,ngnam) != Nullch) {
  86:         free_compex(&ilcompex);
  87:         return TRUE;
  88:     }
  89:     }
  90:     free_compex(&ilcompex);
  91:     return FALSE;
  92: #endif
  93: #else
  94:     return TRUE;
  95: #endif
  96: }
  97: 
  98: #ifdef ONLY
  99: void
 100: end_only()
 101: {
 102:     if (maxngtodo) {            /* did they specify newsgroup(s) */
 103:     int whicharg;
 104: 
 105: #ifdef VERBOSE
 106:     IF(verbose)
 107:         printf("\nRestriction %s%s removed.\n",ngtodo[0],
 108:         maxngtodo > 1 ? ", etc." : nullstr) FLUSH;
 109:     ELSE
 110: #endif
 111: #ifdef TERSE
 112:         fputs("\nExiting \"only\".\n",stdout) FLUSH;
 113: #endif
 114:     for (whicharg = 0; whicharg < maxngtodo; whicharg++) {
 115:         free(ngtodo[whicharg]);
 116: #ifdef SPEEDOVERMEM
 117:         free_compex(compextodo[whicharg]);
 118: #ifndef lint
 119:         free((char*)compextodo[whicharg]);
 120: #endif lint
 121: #endif
 122:     }
 123:     maxngtodo = 0;
 124:     }
 125: }
 126: #endif

Defined functions

end_only defined in line 99; used 3 times
inlist defined in line 56; used 5 times
only_init defined in line 18; used 2 times
setngtodo defined in line 24; used 2 times
Last modified: 1987-03-16
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2663
Valid CSS Valid XHTML 1.0 Strict