|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T l
Length: 1708 (0x6ac) Types: TextFile Names: »list.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit └─⟦5cced586a⟧ »EurOpenD3/news/nntp/nntp.1.5.7.tar.Z« └─⟦7340f105e⟧ └─⟦this⟧ »./server/list.c«
#ifndef lint static char *sccsid = "@(#)list.c 1.11 (Berkeley) 5/11/89"; #endif #include "common.h" /* * LIST * * List active newsgroups, newsgroup descriptions, and distributions. * */ list(argc, argv) int argc; char *argv[]; { char line[NNTP_STRLEN]; char *grparray[2]; char *filename; char *items; char *format; register char *cp; register FILE *list_fp; if (argc == 1 || (argc == 2 && !strcasecmp(argv[1],"active"))){ filename = activefile; items = "active newsgroups"; format = "Newsgroups in form \"group high low y/n/m\"."; } else if (argc == 2 && !strcasecmp(argv[1],"distributions")){ filename = distributionsfile; items = "newsgroup distributions"; format = "Distributions in form \"area description\"."; } else if (argc == 2 && !strcasecmp(argv[1],"newsgroups")){ filename = newsgroupsfile; items = "newsgroup descriptions"; format = "Descriptions in form \"group description\"."; } else { printf("%d Usage: LIST [ACTIVE|NEWSGROUPS|DISTRIBUTIONS]\r\n", ERR_CMDSYN); (void) fflush(stdout); return; } grparray[0] = line; grparray[1] = NULL; list_fp = fopen(filename, "r"); if (list_fp == NULL) { printf("%d No list of %s available.\r\n", ERR_FAULT, items); (void) fflush(stdout); #ifdef SYSLOG syslog(LOG_ERR, "list: fopen %s: %m", filename); #endif return; } printf("%d %s\r\n",OK_GROUPS,format); while (fgets(line, sizeof(line), list_fp) != NULL) { if ((cp = index(line, '\n')) != NULL) *cp = '\0'; if (ngpermcount) if (ngmatch(s1strneql, ALLBUT, ngpermlist, ngpermcount, grparray, 1) == 0) continue; putline(line); } (void) fclose(list_fp); putline("."); (void) fflush(stdout); }