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 g

⟦173cfe61b⟧ TextFile

    Length: 2160 (0x870)
    Types: TextFile
    Names: »group.c«

Derivation

└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
    └─⟦5cced586a⟧ »EurOpenD3/news/nntp/nntp.1.5.7.tar.Z« 
        └─⟦7340f105e⟧ 
            └─⟦this⟧ »./server/group.c« 

TextFile

#ifndef lint
static char	*sccsid = "@(#)group.c	1.12	(Berkeley) 5/11/89";
#endif

#include "common.h"

/*
 * GROUP newsgroup
 *
 * Change the current group to the specified newsgroup.
 * We also change our current directory to that newsgroup if
 * a spool directory for it exists.
 * If the newsgroup specified is invalid, the old newsgroup
 * remains selected.
 */

group(argc, argv)
	int	argc;
	char	*argv[];
{
	char	temp_dir[256];
	int	high_msg, low_msg;
	char	*cp;
	char	*reqlist[2];

	if (argc != 2) {
		printf("%d Usage: GROUP newsgroup.\r\n", ERR_CMDSYN);
		(void) fflush(stdout);
		return;
	}

	if (!canread) {
		printf("%d You only have permission to transfer, sorry.\r\n",
			ERR_ACCESS);
		(void) fflush(stdout);
		return;
	}

	if (index(argv[1], '/') != (char *) NULL) {
		printf("%d Invalid group name (bad format).\r\n", ERR_NOGROUP);
		(void) fflush(stdout);
		return;
	}

	if (find_group(argv[1], num_groups, &low_msg, &high_msg) < 0) {
		printf("%d Invalid group name (not in active).\r\n",
			ERR_NOGROUP);
		(void) fflush(stdout);
		return;
	}

	reqlist[0] = argv[1];
	reqlist[1] = NULL;

	if (ngpermcount) {
		if (ngmatch(s1strneql, ALLBUT,
		    ngpermlist, ngpermcount, reqlist, 1) == 0) {
			printf("%d You're not allowed to read %s, sorry.\r\n",
				ERR_ACCESS, argv[1]);
			(void) fflush(stdout);
			return;
		}
	}

	close_crnt();
	(void) chdir(spooldir);

#ifdef LOG
	syslog(LOG_INFO, "%s group %s", hostname, argv[1]);
#endif

	while ((cp = index(argv[1], '.')) != (char *) NULL)
		*cp = '/';

	(void) strcpy(temp_dir, spooldir);
	(void) strcat(temp_dir, "/");
	(void) strcat(temp_dir, argv[1]);

	/*
	 * (void) because a group can be in the active file
	 * but not have a spool directory.  Just leave us
	 * chdired to base spool directory if this fails.
	 */
	(void) chdir(temp_dir);

#ifdef LOG
	++grps_acsd;
#endif

	num_arts = scan_dir(low_msg, high_msg);
	art_ptr = 0;

	ingroup = 1;

	while ((cp = index(argv[1], '/')) != (char *) NULL)
		*cp = '.';

	printf("%d %d %d %d %s\r\n",
		OK_GROUP,
		num_arts,
		(num_arts > 0 ? art_array[0] : 0),
		(num_arts > 0 ? art_array[num_arts-1] : 0),
		argv[1]);
	(void) fflush(stdout);
}