|
|
1.1 ! root 1: #ifndef lint ! 2: static char *sccsid = "@(#)list.c 1.8 (Berkeley) 7/6/87"; ! 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[MAX_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(strneql, 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: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.