DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T l

⟦3c8fc07db⟧ TextFile

    Length: 1823 (0x71f)
    Types: TextFile
    Names: »list.c«

Derivation

└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
    └─⟦cfd40dc56⟧ »EurOpenD3/news/nntp/nntp.1.5.8.tar.Z« 
        └─⟦2ec98eca6⟧ 
            └─⟦this⟧ »server/list.c« 

TextFile

#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;
		}
		else if (ALLBUT==0) break; /* ngpermcnt==0 && ALLBUT == 0 means
					    * don't print the list, right? */
		putline(line);
	}
	(void) fclose(list_fp);

	putline(".");
	(void) fflush(stdout);
}