File:  [CSRG BSD Unix] / 43BSD / contrib / nntp / server / list.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:54 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43
BSD 4.3

#ifndef lint
static char	*sccsid = "@(#)list.c	1.3	(Berkeley) 3/5/86";
#endif

#include "common.h"

/*
 * LIST
 *
 * List active newsgroups.
 *
 */

list(argc, argv)
int	argc;
char	*argv[];
{
	char		line[MAX_STRLEN];
	register char	*cp;
	register FILE	*active_fp;

	active_fp = fopen(ACTIVE_FILE, "r");

	if (active_fp == NULL) {
		printf("%d No list of newsgroups available.\r\n", ERR_FAULT);
		(void) fflush(stdout);
		syslog(LOG_ERR, "list: fopen %s: %m", ACTIVE_FILE);
		return;
	}

	printf("%d Newsgroups in form \"group high low y/n\".\r\n", OK_GROUPS);

	while (fgets(line, sizeof(line), active_fp) != NULL) {
		if ((cp = index(line, '\n')) != NULL)
			*cp = '\0';
		printf("%s\r\n", line);
	}
	(void) fclose(active_fp);

	printf(".\r\n");
	(void) fflush(stdout);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.