1: #ifndef lint
   2: static char *sccsid = "@(#)list.c	1.10	(Berkeley) 2/6/88";
   3: #endif
   4: 
   5: #include "common.h"
   6: 
   7: /*
   8:  * LIST
   9:  *
  10:  * List active newsgroups.
  11:  *
  12:  */
  13: 
  14: list(argc, argv)
  15:     int     argc;
  16:     char        *argv[];
  17: {
  18:     char        line[NNTP_STRLEN];
  19:     char        *grparray[2];
  20:     register char   *cp;
  21:     register FILE   *active_fp;
  22: 
  23:     grparray[0] = line;
  24:     grparray[1] = NULL;
  25: 
  26:     active_fp = fopen(activefile, "r");
  27: 
  28:     if (active_fp == NULL) {
  29:         printf("%d No list of newsgroups available.\r\n", ERR_FAULT);
  30:         (void) fflush(stdout);
  31: #ifdef SYSLOG
  32:         syslog(LOG_ERR, "list: fopen %s: %m", activefile);
  33: #endif
  34:         return;
  35:     }
  36: 
  37:     printf("%d Newsgroups in form \"group high low y/n/m\".\r\n",
  38:         OK_GROUPS);
  39: 
  40:     while (fgets(line, sizeof(line), active_fp) != NULL) {
  41:         if ((cp = index(line, '\n')) != NULL)
  42:             *cp = '\0';
  43:         if (ngpermcount)
  44:             if (ngmatch(s1strneql, ALLBUT,
  45:                 ngpermlist, ngpermcount,
  46:                 grparray, 1) == 0)
  47:                 continue;
  48:         putline(line);
  49:     }
  50:     (void) fclose(active_fp);
  51: 
  52:     putline(".");
  53:     (void) fflush(stdout);
  54: }

Defined functions

list defined in line 14; used 2 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1988-02-07
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2993
Valid CSS Valid XHTML 1.0 Strict