[mod.sources] v07i059: 2.11 News Source, Part09/09

sources-request@mirror.TMC.COM (11/07/86)

Submitted by: seismo!rick (Rick Adams)
Mod.sources: Volume 7, Issue 59
Archive-name: 2.11news/Part09

# To extract, sh this file
#	news 2.11 source part 9 of 9
if test ! -d src
then
	mkdir src
fi
echo x - src/fullname.c 1>&2
sed 's/.//' >src/fullname.c <<'*-*-END-of-src/fullname.c-*-*'
-/*
- * fullname.c - this file is made separate so that different local
- * conventions can be applied.  The stock version understands two
- * conventions:
- *
- * (a) Berkeley finger: the gecos field in /etc/passwd begins with
- *     the full name, terminated with comma, semicolon, or end of
- *     field.  & expands to the login name.
- * (b) BTL RJE: the gecos field looks like
- *	: junk - full name ( junk :
- *     where the "junk -" is optional.
- *
- * If you have a different local convention, modify this file accordingly.
- */
-
-#ifdef SCCSID
-static char	*SccsId = "@(#)fullname.c	1.11	9/16/86";
-#endif /* SCCSID */
-
-#include "params.h"
-
-#ifndef LOCALNAME
-/*
- * Figure out who is sending the message and sign it.
- * We attempt to look up the user in the gecos field of /etc/passwd.
- */
-char *
-fullname(un)
-char *un;
-{
-	static char inbuf[BUFLEN];
-	struct passwd *pw;
-
-	pw = getpwnam(un);
-	if (pw == NULL)
-		return un;
-	buildfname(pw->pw_gecos, un, inbuf);
-	if (inbuf[0] == 0)
-		return un;
-	return inbuf;
-}
-
-#else
-
-/*
- * Alternative version of fullname which asks the user for his full name.
- * This is mainly suitable for systems that don't have a full name
- * database somewhere.  It puts the answer in $HOME/.name
- */
-char *
-fullname(un)
-char *un;
-{
-	static char inbuf[BUFLEN];
-	char fbuf[BUFLEN];
-	FILE *fd;
-	char *p, *index(), *getenv();
-	int pid;
-
-	if (!isatty(2))
-		return un;
-	printf("What is your full name (for news article signatures): ");
-	fflush(stdout);
-	read(2, inbuf, sizeof inbuf);
-	if (inbuf[0] == 0)
-		return un;
-	p = index(inbuf, '\n');
-	if (p)
-		*p = 0;
-	if ((p = getenv("HOME")) == NULL) {
-		fprintf(stderr,
-		"inews: no HOME environment variable - .name not written\n");
-		return inbuf;
-	}
-	sprintf(fbuf, "%s/%s", p, ".name");
-	if ((pid = vfork()) < 0) {
-		perror("inews");
-		return inbuf;
-	}
-	else if (pid != 0)
-		while (wait((int *)0) != pid)
-			;
-	else {
-		setuid(getuid());	/* become the user */
-		if ((fd = fopen(fbuf, "w")) == NULL)
-			fprintf(stderr, "inews: can't create %s\n", fbuf);
-		else {
-			fprintf(fd, "%s\n", inbuf);
-			fclose(fd);
-		}
-		exit(0);
-	}
-	return inbuf;
-}
-#endif
-
-#ifndef LOCALNAME
-/*
-**  BUILDFNAME -- build full name from gecos style entry.
-**	(routine lifted from sendmail)
-**
-**	This routine interprets the strange entry that would appear
-**	in the GECOS field of the password file.
-**
-**	Parameters:
-**		p -- name to build.
-**		login -- the login name of this user (for &).
-**		buf -- place to put the result.
-**
-**	Returns:
-**		none.
-**
-**	Side Effects:
-**		none.
-*/
-
-buildfname(p, login, buf)
-	register char *p;
-	char *login;
-	char *buf;
-{
-	register char *bp = buf;
-
-	if (*p == '*')
-		p++;
-	while (*p != '\0' && *p != ',' && *p != ';' && *p != ':' && *p != '(')
-	{
-		if (*p == '-') {
-			bp = buf;
-			p++;
-		}
-		else if (*p == '&')
-		{
-			strcpy(bp, login);
-			if ((bp == buf || !isalpha(bp[-1])) && islower(*bp))
-				*bp = toupper(*bp);
-			while (*bp != '\0')
-				bp++;
-			p++;
-		}
-		else
-			*bp++ = *p++;
-	}
-	*bp = '\0';
-}
-#endif
*-*-END-of-src/fullname.c-*-*
echo x - src/berknews.c 1>&2
sed 's/.//' >src/berknews.c <<'*-*-END-of-src/berknews.c-*-*'
-/*
- * berknews - send news article via Berknet
- * 
- * Synopsis:
- *	berknews [-o] [-n newsgroup] host_net_command machine remote_rnews
- */
-
-#ifdef SCCSID
-static char *SccsId = "@(#)berknews.c	2.5	4/16/85";
-#endif /* SCCSID */
-
-#include <stdio.h>
-#include <ctype.h>
-#ifndef USG
-#include <whoami.h>
-struct utsname {
-	char	Sysname[9];
-	char	nodename[33];
-	char	release[9];
-	char	version[9];
-};
-#else /* USG */
-#include <sys/utsname.h>
-#endif /* USG */
-
-
-struct network {
-	char *uucpname;
-	char *berkname;
-} berknet[] = {
-/*	UUCP Net Name	BerkNet Name
-	-------------	------------	*/	
-	"ucbvax",	"CSVAX",
-	"populi",	"G",
-	"ucbarpa",	"ARPAVAX",
-	"ucbcfo-c",	"C",
-	"ucbopt",	"ESVAX",
-	"ucbcad",	"ucbcad",
-	"ucbcory",	"Cory",
-	"ucb",		"C70",
-	"ucbmathstat",	"MathStat",
-	"ucbonyx",	"Onyx",
-	"ucbkim",	"Kim",
-	"ucbcfo-a",	"A",
-	"ucbcfo-b",	"B",
-	"ucbcfo-d",	"D",
-	"ucbcfo-e",	"E",
-	"ucbcfo-f",	"F",
-	"ucbingvax",	"IngVAX",
-	"ucbingres",	"Ingres",
-	"ucbeecs40",	"EECS40",
-	"ucbvlsi",	"VLSI",
-	"ucbsrc",	"SRC",
-	"ucbimage",	"Image",
-	'\0',		'\0'
-};
-
-char *index();
-char buffer[BUFSIZ];
-int linecount;
-
-FILE *popen();
-main(argc, argv)
-int argc;
-char **argv;
-{
-	FILE *out;
-	char sender[BUFSIZ],newsgroup[100];
-	char *punct;
-	char sysn[20];
-	int sysnl;
-	struct utsname ubuf;
-
-	if (argc < 4) {
-		fprintf(stderr, "Too few arguments.\n");
-		exit(1);
-	}
-
-#ifdef debug
-	printf("%s - -m%s %s\n", argv[1], argv[2], argv[3]);
-	sprintf(buffer, "cat");
-#else
-	sprintf(buffer, "%s - -m%s %s", argv[1], argv[2], argv[3]);
-#endif
-	out = popen(buffer, "w");
-	uname(&ubuf);
-	strcpy(sysn, ubuf.nodename);
-	strcat(sysn, "!");
-	sysnl = strlen(sysn);
-
-	while (fgets(buffer, sizeof buffer, stdin)) {
-		if (fromline()) {
-			punct = index(buffer, '!');
-			if (punct == NULL)
-				printf("Bad from line: '%s'\n", buffer);
-			else {
-				*punct = ':';	/* berknet mail delimiter */
-				if (!strncmp("From: ", buffer, 6))
-					punct = &buffer[6];
-				else if (!strncmp("From ",buffer,5))
-					punct = &buffer[5];
-				else
-					punct = buffer;
-				fiddle(punct);
-			}
-		}
-		fputs(buffer, out);
-	}
-	pclose(out);
-	exit(0);
-}
-
-fromline() {
-	if (!linecount && (!strncmp("From: ", buffer, 6) || !strncmp("From ", buffer, 5)))
-		return ++linecount;
-	return 0;
-}
-
-/*
- * make sure the host name is a correct berknet address, since the
- * internal names are not the berknet host names.
- */
-fiddle(buf)
-char *buf;
-{
-	char uucpname[100];
-	register struct network *netptr;
-	char *rest;
-
-	strcpy(uucpname, buf);
-	rest = index(uucpname, ':');
-	*rest++ = 0;
-#ifdef debug
-	printf("uucpname = '%s', buf = '%s', rest = '%s'\n", uucpname, buf, rest);
-#endif
-	for (netptr = &berknet[0]; strcmp(netptr->uucpname, uucpname) && netptr->uucpname; netptr++)
-		;
-	if (netptr->uucpname)
-		sprintf(buf, "%s:%s", netptr->berkname, rest);
-	else
-		sprintf(buf, "UNKNOWN:%s", rest);
-}
*-*-END-of-src/berknews.c-*-*
echo x - src/params.h 1>&2
sed 's/.//' >src/params.h <<'*-*-END-of-src/params.h-*-*'
-/*
- * params.h - parameters for everyone.
- */
-
-/*	@(#)params.h	2.21	10/23/86		*/
-
-#include <stdio.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <grp.h>
-#include <pwd.h>
-#include <sys/stat.h>
-#include <ctype.h>
-
-#include "defs.h"
-
-#if defined(BSD4_2) || defined(BSD4_1C)
-#include <sys/time.h>
-#else /* sane */
-#include <time.h>
-#endif /* sane */
-
-#ifndef UNAME
-/*
- * 9 bytes is for compatibility with USG, in case you forget to define UNAME.
- * 33 bytes in nodename because many sites have names longer than 8 chars.
- */
-
-struct utsname {
-	char	sysname[9];
-	char	nodename[33];
-	char	release[9];
-	char	version[9];
-};
-#else
-#include <sys/utsname.h>
-#endif
-
-#ifndef USG
-#include <sys/timeb.h>
-#else
-struct timeb
-{
-	time_t	time;
-	unsigned short millitm;
-	short	timezone;
-	short	dstflag;
-};
-#endif
-
-#include "header.h"
-
-/* line from SUBFILE */
-struct	srec {
-	char	s_name[2*BUFLEN];	/* system name		*/
-	char	*s_nosend;		/* systems that inhibit sending */
-	char	s_nbuf[LBUFLEN];	/* system subscriptions */
-	char	s_flags[BUFLEN];	/* system flags		*/
-	char	s_xmit[LBUFLEN];	/* system xmit routine	*/
-};
-
-extern	int	uid, gid, duid, dgid;
-extern	int	savmask, SigTrap, mode, lockcount;
-extern	struct	hbuf header;
-extern	char	bfr[LBUFLEN], *username, *userhome;
-
-extern	char	*SPOOL, *LIB, *BIN, *SUBFILE, *ACTIVE;
-extern	char	*LOCKFILE, *SEQFILE, *ARTFILE;
-extern	char	*news_version, *Progname;
-
-#ifdef NOTIFY
-extern	char	*TELLME;
-#endif /* NOTIFY */
-
-#ifdef HIDDENNET
-extern char	*LOCALSYSNAME;
-#endif /* HIDDENNET */
-
-extern	char	*FULLSYSNAME;
-#ifndef SHELL
-extern char	*SHELL;
-#endif /* !SHELL */
-
-/* external function declarations */
-extern	FILE	*xfopen(), *hread();
-extern	char	*strcpy(), *strncpy(), *strcat(), *index(), *rindex();
-extern	char	*ctime(), *mktemp(), *malloc(), *realloc(), *getenv();
-extern	char	*arpadate(), *dirname(), *AllocCpy(), *strpbrk();
-extern	char	*errmsg();
-extern	struct	passwd *getpwnam(), *getpwuid(), *getpwent();
-extern	struct	group *getgrnam();
-extern	time_t	time(), getdate(), cgtdate();
-extern	int	broadcast(), save(), newssave(), ushell(), onsig();
-extern	long	atol();
-extern	struct	tm *localtime();
-
-#ifdef lint
-/* This horrible gross kludge is the only way I know to
- * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN.
- */
-#ifdef SIG_IGN
-#undef SIG_IGN
-#endif /* SIG_IGN */
-#define SIG_IGN	main
-extern int main();
-#endif /* lint */
-
-#ifdef VMS
-#define LINK(a,b)	vmslink(a,b)
-#define UNLINK(a)	vmsdelete(a)
-FILE *art_open(), *xart_open();
-#else	
-#define LINK(a,b)	link(a,b)
-#define UNLINK(a)	unlink(a)
-#define art_open fopen
-#define xart_open xfopen
-#endif /* !VMS */
*-*-END-of-src/params.h-*-*
echo x - src/uname.c 1>&2
sed 's/.//' >src/uname.c <<'*-*-END-of-src/uname.c-*-*'
-/*
- * This software is Copyright (c) 1986 by Rick Adams.
- *
- * Permission is hereby granted to copy, reproduce, redistribute or
- * otherwise use this software as long as: there is no monetary
- * profit gained specifically from the use or reproduction or this
- * software, it is not sold, rented, traded or otherwise marketed, and
- * this copyright notice is included prominently in any copy
- * made.
- *
- * The author make no claims as to the fitness or correctness of
- * this software for any use whatsoever, and it is provided as is. 
- * Any use of this software is at the user's own risk.
- *
- * This routine is compatible with the Unix T/S system call uname,
- * which figures out the name of the local system.
- * However, we do it by reading the file /usr/include/whoami.h.
- * This avoids having to recompile uucp for each site and hence
- * avoids having to distribute the source to uucp to people who
- * have only binary licenses.
- */
-
-#ifdef SCCSID
-static char	*SccsId = "@(#)uname.c	2.11	10/23/86";
-#endif /* SCCSID */
-
-#include "params.h"
-
-#ifdef UNAME
-# define DONE
-#endif /* UNAME */
-
-#ifdef GHNAME
-uname(uptr)
-struct utsname *uptr;
-{
-	char *cp;
-	gethostname(uptr->nodename, sizeof (uptr->nodename));
-	cp = index(uptr->nodename, '.');
-	if (cp)
-		*cp = '\0';
-}
-# define DONE
-#endif
-
-#ifdef	UUNAME
-uname(uptr)
-struct utsname *uptr;
-{
-	FILE *uucpf;
-	register char *p;
-	/* uucp name is stored UUNAME */
-
-	if (((uucpf = fopen(UUNAME, "r")) == NULL) ||
-		fgets(uptr->nodename, sizeof (uptr->nodename), uucpf) == NULL) {
-			fprintf(stderr, "no sysname in %s\n", UUNAME);
-			return;
-	}
-	p = index(uptr->nodename, '\n');
-	if (p)
-		*p = '\0';
-	if (uucpf != NULL)
-		fclose(uucpf);
-}
-#define DONE
-#endif /* UUNAME */
-
-#ifndef DONE
-#define	HDRFILE "/usr/include/whoami.h"
-
-uname(uptr)
-struct utsname *uptr;
-{
-	char buf[BUFSIZ];
-	FILE *fd;
-	
-	fd = fopen(HDRFILE, "r");
-	if (fd == NULL) {
-		fprintf(stderr, "Cannot open %s\n", HDRFILE);
-		exit(1);
-	}
-	
-	for (;;) {	/* each line in the file */
-		if (fgets(buf, sizeof buf, fd) == NULL) {
-			fprintf(stderr, "no sysname in %s\n", HDRFILE);
-			fclose(fd);
-			exit(2);
-		}
-		if (sscanf(buf, "#define sysname \"%[^\"]\"", uptr->nodename) == 1) {
-			fclose(fd);
-			return;
-		}
-	}
-}
-#endif
*-*-END-of-src/uname.c-*-*
echo x - src/logdir.c 1>&2
sed 's/.//' >src/logdir.c <<'*-*-END-of-src/logdir.c-*-*'
-/*
- *	UNIX shell - logdir routine
- *
- *	Joe Steffen
- *	Bell Telephone Laboratories
- *
- *	This routine does not use the getpwent(3) library routine
- *	because the latter uses the stdio package.  The allocation of
- *	storage in this package destroys the integrity of the shell's
- *	storage allocation.
- *
- *	Modified 2/82 by DJ Molny
- *
- *	This routine now implements name cacheing, so multiple requests
- *	for the same logdir do not result in multiple open/reads of
- *	/etc/passwd.  If the previous request was successful and the name
- *	is the same as the last request, the same login directory is returned.
- */
-#ifdef SCCSID
-static char	*SccsId = "@(#)logdir.c	1.4	4/16/85";
-#endif /* SCCSID */
-
-#define	BUFSIZ	160
-
-static char line[BUFSIZ+1];
-
-char *
-logdir(name)
-char *name;
-{
-	int	pwf;
-	static char lastname[BUFSIZ+1];
-	static char lastdir[BUFSIZ+1];
-	register char *p;
-	register int i, j;
-	char *getenv(), *field(), *strcpy();
-	
-	if (*lastdir && !strcmp(lastname,name))		/* djm */
-		return(lastdir);
-
-	strcpy(lastname, name);			/* djm */
-	strcpy(lastdir, "");			/* djm */
-	
-#ifdef IHCC
-	/* if the logname is exptools, see if $TOOLS is set */
-	if (strcmp(name, "exptools") &&
-	    (p = getenv("TOOLS")) != 0 && *p != '\0') {
-		strcpy(lastdir, p);
-		return(lastdir);
-	}
-#endif
-
-	/* attempt to open the password file */
-	if ((pwf = open("/etc/passwd", 0)) == -1)
-		return(0);
-		
-	/* find the matching password entry */
-	do {
-		/* get the next line in the password file */
-		i = read(pwf, line, BUFSIZ);
-		for (j = 0; j < i; j++)
-			if (line[j] == '\n')
-				break;
-		/* return a null pointer if the whole file has been read */
-		if (j >= i)
-			return(0);
-		line[++j] = 0;			/* terminate the line */
-		lseek(pwf, (long) (j - i), 1);	/* point at the next line */
-		p = field(line);		/* get the logname */
-	} while (strcmp(name, line) != 0);
-	close(pwf);
-	
-	/* skip the intervening fields */
-	p = field(p);
-	p = field(p);
-	p = field(p);
-	p = field(p);
-	
-	/* return the login directory */
-	field(p);
-	strcpy(lastdir,p);			/* djm */
-	return(p);
-}
-
-static char *
-field(p)
-register char *p;
-{
-	while (*p && *p != ':')
-		++p;
-	if (*p) *p++ = 0;
-	return(p);
-}
*-*-END-of-src/logdir.c-*-*
echo x - src/rparams.h 1>&2
sed 's/.//' >src/rparams.h <<'*-*-END-of-src/rparams.h-*-*'
-/*
- * rparams.h - parameters for readnews, rfuncs, and readr.
- */
-
-/*	@(#)rparams.h	2.23	10/23/86	*/
-
-#include "params.h"
-
-/* flags for readnews */
-#define pflag	options[0].flag
-#define tflag	options[1].flag
-#define aflag	options[2].flag
-#define nflag	options[3].flag
-#define cflag	options[4].flag
-#define lflag	options[5].flag
-#define rflag	options[6].flag
-#define sflag	options[7].flag
-#define xflag	options[8].flag
-#define hflag	options[9].flag
-#define Mflag	options[10].flag
-#define fflag	options[11].flag
-#define uflag	options[12].flag
-#define eflag	options[13].flag
-#define Kflag	options[14].flag
-
-#define	NEXT	0
-#define SPEC	1
-
-#define	FORWARD	0
-#define BACKWARD 1
-
-#define UNKNOWN 0001	/* possible modes for news program */
-#define MAIL	0004
-#define ANY	0007
-
-struct optable {			/* options table. */
-	char	optlet;		/* option character. */
-	char	filchar;	/* if to pickup string, fill character. */
-	int	flag;		/* TRUE if have seen this opt. */
-	int	newstate;	/* STRING if takes arg, else OPTION */
-	int	oldmode;	/* OR of legal input modes. */
-	int	newmode;	/* output mode. */
-	char	*buf;		/* string buffer */
-};
-
-/* external declarations specific to readnews */
-extern	char	*infile, *outfile, *PAGER, *ALIASES;
-extern	char	*bitmap, *MAILER, *MAILPARSER;
-
-#ifndef ROOTID
-extern	int	ROOTID;
-#endif
-
-#ifdef NOTIFY
-extern	char	*TELLME;
-#endif
-
-extern char	filename[],coptbuf[],datebuf[],afline[];
-extern char	newsrc[],groupdir[],rcbuf[],*rcline[],*argvrc[];
-extern int	mode, ngrp, line, newrc(), readmode, news;
-extern long	bit, obit, last, ngsize, minartno;
-extern FILE	*rcfp,*actfp;
-extern time_t	atime;
-extern struct optable *optpt, options[];
-extern int	actdirect, rcreadok, zapng;
-
-#ifndef lint
-/* lint gets very mad about i-minartno, this is one way of shutting it up */
-/* macros */
-#define get(i)	((i<minartno)? 0 : (bitmap[(i-minartno) >> 3] & (1 << (i-minartno) % 8)))
-#define set(i)	if (i>=minartno) bitmap[(i-minartno) >> 3] |= (1 << (i-minartno) % 8);else
-#define clear(i) if (i>=minartno) bitmap[(i-minartno) >> 3] &= ~(1 << (i-minartno) % 8);else
-#endif /* !lint */
-
-#define FCLOSE(fp)	{if (fp != NULL) {fclose(fp);fp = NULL;}}
*-*-END-of-src/rparams.h-*-*
echo x - src/ndir.c 1>&2
sed 's/.//' >src/ndir.c <<'*-*-END-of-src/ndir.c-*-*'
-#include "defs.h"
-#if !defined(BSD4_2) && !defined(BSD4_1C)
-#include <sys/param.h>
-#include "ndir.h"
-
-#ifdef SCCSID
-static char	*SccsId = "@(#)ndir.c	1.8	4/26/85";
-#endif /* SCCSID */
-
-/*
- * support for Berkeley directory reading routine on a V7 file system
- */
-
-extern char *malloc();
-
-/*
- * open a directory.
- */
-DIR *
-opendir(name)
-char *name;
-{
-	register DIR *dirp;
-	register int fd;
-
-	if ((fd = open(name, 0)) == -1)
-		return NULL;
-	if ((dirp = (DIR *)malloc(sizeof(DIR))) == NULL) {
-		close (fd);
-		return NULL;
-	}
-	dirp->dd_fd = fd;
-	dirp->dd_loc = 0;
-	return dirp;
-}
-
-/*
- * read an old style directory entry and present it as a new one
- */
-#ifdef pyr
-/* Pyramid in the AT&T universe */
-#define ODIRSIZ 248
-struct olddirect {
-	long	od_ino;
-	short	od_fill1, od_fill2;
-	char od_name[ODIRSIZ];
-};
-#else /* V7 file system */
-#define	ODIRSIZ	14
-
-struct	olddirect {
-	short	od_ino;
-	char	od_name[ODIRSIZ];
-};
-#endif /* V7 */
-
-/*
- * get next entry in a directory.
- */
-struct direct *
-readdir(dirp)
-register DIR *dirp;
-{
-	register struct olddirect *dp;
-	static struct direct dir;
-
-	for (;;) {
-		if (dirp->dd_loc == 0) {
-			dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, 
-			    DIRBLKSIZ);
-			if (dirp->dd_size <= 0)
-				return NULL;
-		}
-		if (dirp->dd_loc >= dirp->dd_size) {
-			dirp->dd_loc = 0;
-			continue;
-		}
-		dp = (struct olddirect *)(dirp->dd_buf + dirp->dd_loc);
-		dirp->dd_loc += sizeof(struct olddirect);
-		if (dp->od_ino == 0)
-			continue;
-		dir.d_ino = dp->od_ino;
-		strncpy(dir.d_name, dp->od_name, ODIRSIZ);
-		dir.d_name[ODIRSIZ] = '\0'; /* insure null termination */
-		dir.d_namlen = strlen(dir.d_name);
-		dir.d_reclen = DIRSIZ(&dir);
-		return (&dir);
-	}
-}
-
-/*
- * close a directory.
- */
-void
-closedir(dirp)
-register DIR *dirp;
-{
-	close(dirp->dd_fd);
-	dirp->dd_fd = -1;
-	dirp->dd_loc = 0;
-	free((char *)dirp);
-}
-#endif /* !BSD4_2 && !BSD4_1C */
*-*-END-of-src/ndir.c-*-*
echo x - src/sendnews.c 1>&2
sed 's/.//' >src/sendnews.c <<'*-*-END-of-src/sendnews.c-*-*'
-/*
- * sendnews - send news article by mail.
- */
-
-#ifdef SCCSID
-static char	*SccsId = "@(#)sendnews.c	2.11	9/19/86";
-#endif /* SCCSID */
-
-#include <stdio.h>
-#include <ctype.h>
-
-char buffer[BUFSIZ];
-
-int linecount, oflag = 0, aflag = 0, bflag = 0, toflag = 0;
-
-extern FILE *popen();
-
-/* ARGSUSED */
-main(argc, argv)
-char **argv;
-{
-	register FILE *out;
-	char newsgroup[BUFSIZ];
-
-	while (**(++argv) == '-') {
-		if (*++*argv == 'o')
-			oflag++;
-		else if (**argv == 'a')
-			aflag++;
-		else if (**argv == 'b')
-			bflag++;
-		else if (**argv == 'n')
-			strcpy(newsgroup, *(++argv));
-	}
-	if (aflag && bflag) {
-		fprintf(stderr, "'-a' and '-b' options mutually exclusive.\n");
-		exit(1);
-	}
-
-#ifdef DEBUG
-	printf("/bin/mail %s\n", *argv);
-	sprintf(buffer, "cat");
-#else
-#ifdef SENDMAIL
-	(void) sprintf(buffer, "%s -i -odq %s", SENDMAIL, *argv);
-#else /* !SENDMAIL */
-	(void) sprintf(buffer, "/bin/mail %s", *argv);
-#endif /* !SENDMAIL */
-#endif
-	if ((out = popen(buffer, "w")) == NULL) {
-		perror(buffer);
-		exit(1);
-	}
-
-	/* Standard mail prelude to make the formatters happy */
-	fprintf(out, "Subject: network news article\n");
-	fprintf(out, "To: %s\n\n", *argv);
-
-	while (fgets(buffer, sizeof buffer, stdin)) {
-		if (*newsgroup && ngline()) {
-			if (oflag)
-				sprintf(buffer, "%s\n", newsgroup);
-			else
-				sprintf(buffer, "Newsgroups: %s\n", newsgroup);
-		}
-		putc('N', out);
-		fputs(buffer, out);
-		if (ferror(out))
-			exit(1);
-	}
-	pclose(out);
-	exit(0);
-}
-
-ngline()
-{
-	if (oflag)
-		return linecount == 2;
-	if (!toflag && (!strncmp("Newsgroups: ", buffer, 12) ||
-		!strncmp("To: ",buffer, 4)))
-		return ++toflag;
-	return 0;
-}
*-*-END-of-src/sendnews.c-*-*
echo x - src/vnews.help 1>&2
sed 's/.//' >src/vnews.help <<'*-*-END-of-src/vnews.help-*-*'
-Vnews commands:    (each may be preceded by a non-negative count)
-
-CR  Next page or article                D   Decrypt a rot 13 joke
-n   Go to next article                  A   Go to article numbered count
-e   Mark current article as unread      <   Go to article with given ID
-+   Go forwards count articles          p   Go to parent article
--   Go to previous article              ug  Unsubscribe to this group
-^B  Go backwards count pages            ^L  Redraw screen
-^N  Go forward count lines              v   Print netnews version
-^P  Go backwards count lines            q   Quit
-^D  Go forward half a page              x   Quit without updating .newsrc
-^U  Go backwards half a page            c   Cancel the current article
-h   Display article header              H   Display all article headers
-!   Escape to shell                     ?   Display this message
-r   Reply to article using editor       K   Mark rest of newsgroup read
-R   Reply--put current article in reply b   Go back 1 article in same group
-ESC-r  Reply directly using mailer      m   Move on to next item in a digest
-f   Post a followup article             s   Save article in file
-N   Go to newsgroup (next is default)   w   Save without header
-l   Display article (use after !, r, f, or ?)
-
-[Press l to see article again]
*-*-END-of-src/vnews.help-*-*
echo x - src/header.h 1>&2
sed 's/.//' >src/header.h <<'*-*-END-of-src/header.h-*-*'
-/*
- * header.h - Article header format
- */
-
-/*	@(#)header.h	2.19	1/17/86	*/
-
-#define NUNREC 50
-
-/* article header */
-struct	hbuf {
-	char	from[BUFLEN];		/* From:		*/
-	char	path[PATHLEN];		/* Path:		*/
-	char	nbuf[BUFLEN];		/* Newsgroups:		*/
-	char	title[BUFLEN];		/* Subject:		*/
-	char	ident[BUFLEN];		/* Message-ID:		*/
-	char	replyto[BUFLEN];	/* Reply-To:		*/
-	char	followid[BUFLEN];	/* References:		*/
-	char	subdate[DATELEN];	/* Date: (submission)	*/
-	time_t	subtime;		/* subdate in secs	*/
-	char	expdate[DATELEN];	/* Expires:		*/
-	char	ctlmsg[PATHLEN];	/* Control:		*/
-	char	sender[BUFLEN];		/* Sender:		*/
-	char	followto[BUFLEN];	/* Followup-to:		*/
-	char	distribution[BUFLEN];	/* Distribution:	*/
-	char	organization[BUFLEN];	/* Organization:	*/
-	char	numlines[8];		/* Lines:		*/
-	int	intnumlines;		/* Integer version	*/
-	char	keywords[BUFLEN];	/* Keywords:		*/
-	char	summary[BUFLEN];	/* Summary:		*/
-	char	approved[BUFLEN];	/* Approved:		*/
-	char	nf_id[BUFLEN];		/* Nf-ID:		*/
-	char	nf_from[BUFLEN];	/* Nf-From:		*/
-#ifdef DOXREFS
-	char 	xref[BUFLEN];		/* Xref:		*/
-#endif /* DOXREFS */
-	char	*unrec[NUNREC];		/* unrecognized lines	*/
-};
-
-#define hwrite(hp,fp)	ihwrite(hp,fp,0)
-#define lhwrite(hp,fp)	ihwrite(hp,fp,1)
-
-char *oident();
*-*-END-of-src/header.h-*-*
echo x - src/sendbatch.sh 1>&2
sed 's/.//' >src/sendbatch.sh <<'*-*-END-of-src/sendbatch.sh-*-*'
-: '@(#)sendbatch.sh	1.10	9/23/86'
-
-cflags=
-LIM=50000
-CMD='LIBDIR/batch BATCHDIR/$rmt $BLIM'
-ECHO=
-COMP=
-C7=
-DOIHAVE=
-RNEWS=rnews
-
-for rmt in $*
-do
-	case $rmt in
-	-[bBC]*)	cflags="$cflags $rmt"; continue;;
-	-s*)	LIM=`expr "$rmt" : '-s\(.*\)'`
-		continue;;
-	-c7) 	COMP='| LIBDIR/compress $cflags'
-		C7='| LIBDIR/encode'
-		ECHO='echo "#! c7unbatch"'
-		continue;;
-	-c)	COMP='| LIBDIR/compress $cflags'
-		ECHO='echo "#! cunbatch"'
-		continue;;
-	-o*)	ECHO=`expr "$rmt" : '-o\(.*\)'`
-		RNEWS='cunbatch'
-		continue;;
-	-i*)	DOIHAVE=`expr "$rmt" : '-i\(.*\)'`
-		if test -z "$DOIHAVE"
-		then
-			DOIHAVE=`uuname -l`
-		fi
-		continue;;
-	esac
-
-	if test -n "$COMP"
-	then
-		BLIM=`expr $LIM \* 2`
-	else
-		BLIM=$LIM
-	fi
-
-	: make sure $? is zero
-	while test $? -eq 0 -a \( -s BATCHDIR/$rmt -o -s BATCHDIR/$rmt.work -o  \( -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave \) \)
-	do
-		if test -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave
-		then
-			mv BATCHDIR/$rmt.ihave BATCHDIR/$rmt.$$
-			LIBDIR/inews -t "cmsg ihave $DOIHAVE" -n to.$rmt.ctl < \
-				BATCHDIR/$rmt.$$
-			rm BATCHDIR/$rmt.$$
-					
-		else
-			(eval $ECHO; eval $CMD $COMP $C7) |
-			if test -s BATCHDIR/$rmt.cmd
-			then
-				BATCHDIR/$rmt.cmd
-			else
-				uux - UUXFLAGS $rmt!$RNEWS
-			fi
-		fi
-	done
-done
*-*-END-of-src/sendbatch.sh-*-*
echo x - src/ndir.h 1>&2
sed 's/.//' >src/ndir.h <<'*-*-END-of-src/ndir.h-*-*'
-/* @(#)ndir.h	1.4	4/16/85 */
-#ifndef DEV_BSIZE
-#define	DEV_BSIZE	512
-#endif
-#define DIRBLKSIZ	DEV_BSIZE
-#define	MAXNAMLEN	255
-
-struct	direct {
-	long	d_ino;			/* inode number of entry */
-	short	d_reclen;		/* length of this record */
-	short	d_namlen;		/* length of string in d_name */
-	char	d_name[MAXNAMLEN + 1];	/* name must be no longer than this */
-};
-
-/*
- * The DIRSIZ macro gives the minimum record length which will hold
- * the directory entry.  This requires the amount of space in struct direct
- * without the d_name field, plus enough space for the name with a terminating
- * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
- */
-
-#ifdef DIRSIZ
-#undef DIRSIZ
-#endif /* DIRSIZ */
-#define DIRSIZ(dp) \
-    ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
-
-/*
- * Definitions for library routines operating on directories.
- */
-typedef struct _dirdesc {
-	int	dd_fd;
-	long	dd_loc;
-	long	dd_size;
-	char	dd_buf[DIRBLKSIZ];
-} DIR;
-#ifndef NULL
-#define NULL 0
-#endif
-extern	DIR *opendir();
-extern	struct direct *readdir();
-extern	void closedir();
*-*-END-of-src/ndir.h-*-*
echo x - src/help 1>&2
sed 's/.//' >src/help <<'*-*-END-of-src/help-*-*'
-Command		Meaning
-
-y		Yes.  (Or just hit return.)  Prints this article and goes on.
-n		No.  Goes on to next article without printing current one.
-d		Digest.  Breaks a digest article up into seperate articles.
-q		Quit.  Update .newsrc if -l or -x not used.
-U		Unsubscribe.  You won't be shown this newsgroup anymore.
-c		Cancel an article you posted.
-r		Reply.  Reply to article's author via mail.
-f [title]	Submit a follow up article.
-N [newsgroup]	Go to next newsgroup or named newsgroup.
-s [file]	Save.  Article is appended to file (default is "Articles").
-s |program	Run program with article as standard input.
-e		Erase.  Forget that an article was read.
-h		Print verbose header.  Use H for extremely verbose header.
-!		Shell escape.
-<number>	Go to message #<number> in this newsgroup.
--		Go back to last article.
-b		Back up one article in the current group.
-K		Mark the rest of the articles in current group as read.
-x		Exit.  Don't update .newsrc.
-v		Version.  Print current news version number.
-
-c, f, r, e, h, and s can be followed by -'s to refer to the previous article
*-*-END-of-src/help-*-*
echo x - src/localize.7300 1>&2
sed 's/.//' >src/localize.7300 <<'*-*-END-of-src/localize.7300-*-*'
-#From philabs!hhb!kosman!kevin Mon Apr 28 15:56:44 1986
-rm -f Makefile
-cp Makefile.dst Makefile
-chmod u+w Makefile
-
-ed - Makefile  <<'EOF'
-g/^#USG /s///
-g/^#V7 /d
-g/^#VMS /d
-g/^#BSD4_[123] /d
-/CFLAGS[	 ]*=/t.
-.s/CFLAGS/MFLAGS/p
-.s/-Dindex.*strrchr//p
-/-o compress compress.c/s//compress.c -o compress/p
-g/Makefile.dst/s//Makefile/p
-/-o postnews/s/$(CFLAGS) //
-g/$(CFLAGS) $(LFLAGS)/t.\
-.-1s/$(LFLAGS)/-c/\
-s/ -o .*//p\
-.+1s/ $(CFLAGS)//\
-s/\.c/.o/p
-/-c compress.c/s/CFLAGS/MFLAGS/p
-g/$(LFLAGS)/s;$(LFLAGS);& /lib/crt0s.o shlib.ifile;\
-s/$(CC)/$(LD)/\
-s/-ltermlib //
-g/chmod 755.*inews/s/755/6755/p
-/UUXFLAGS =/s/ -z//p
-w
-q
-EOF
-
-rm -f defs.h
-cp defs.dist defs.h
-chmod u+w defs.h
-
-ed - defs.h <<'EOF'
-/DFLTSUB/s/".*"/"all"/p
-/ROOTID/s/10/101/p
-/TMAIL/s;^;/*;p
-/PAGE/s;/usr/ucb/more;/usr/bin/less;p
-/DFTXMIT/s/ -z//p
-/UXMIT/s/ -z//p
-/UNAME/s;/\* ;;p
-/DOXREF/s;/\* ;;p
-/MYORG/s;".*";"/etc/MYORG";p
-w
-q
-EOF
-
-rm -f shlib.ifile
-cat /lib/shlib.ifile >shlib.ifile
-chmod u+w shlib.ifile
-
-ed - shlib.ifile <<'EOF'
-/^PC /d
-/^BC /d
-/^UP /d
-/^ospeed /d
-/^COLS /d
-/^_sibuf /i
-EOF
*-*-END-of-src/localize.7300-*-*
echo x - src/localize.4.3 1>&2
sed 's/.//' >src/localize.4.3 <<'*-*-END-of-src/localize.4.3-*-*'
-rm -f Makefile
-cp Makefile.dst Makefile
-chmod u+w Makefile
-ed - Makefile  <<'EOF'
-g/^#V7 /s///
-g/^#BSD4_3 /s///
-g/^#USG /d
-g/^#VMS /d
-g/^#BSD4_1 /d
-/^UUXFLAGS/s/-r -z/-r -z -n -gd/
-/^LIBDIR/s;/usr/lib/news;/usr/new/lib/news;
-/^BINDIR/s;/usr/bin;/usr/new;
-w
-q
-EOF
-rm -f defs.h
-cp defs.dist defs.h
-chmod u+w defs.h
-ed - defs.h <<'EOF'
-/N_UMASK/s/000/002/
-/DFTXMIT/s/-z/-z -gd/
-/UXMIT/s/-z/-z -gd/
-/INTERNET/s;/\* ;;
-/GHNAME/s;/\* ;;
-/DOXREFS/s;/\* ;;
-/BSD4_2/s;/\* ;;
-/SENDMAIL/s;/\* ;;
-w
-q
-EOF
-echo "Make sure that /usr/new is in PATH in /usr/lib/uucp/L.cmds; read ../misc/L.cmds"
*-*-END-of-src/localize.4.3-*-*
echo x - src/iparams.h 1>&2
sed 's/.//' >src/iparams.h <<'*-*-END-of-src/iparams.h-*-*'
-/*
- * iparams - parameters for inews.
- */
-
-/*	@(#)iparams.h	2.16	10/23/86	*/
-
-#include "params.h"
-
-/* external declarations specific to inews */
-extern	char	nbuf[LBUFLEN], *ARTICLE, *INFILE, *ALIASES, *PARTIAL;
-#ifndef ROOTID
-extern	int	ROOTID;
-#endif
-
-#ifdef NOTIFY
-extern	char	*TELLME;
-#endif /* NOTIFY */
-
-struct msgtype {
-	char *m_name;
-	char *m_who_to;
-	int (*m_func)();
-};
-
-extern struct msgtype msgtype[];
-
-extern	FILE	*infp, *actfp;
-extern	int	tty, is_ctl;
-extern	char	filename[BUFLEN], is_mod[NAMELEN], not_here[SBUFLEN], *DFLTNG;
*-*-END-of-src/iparams.h-*-*
echo x - src/rmgroup.sh 1>&2
sed 's/.//' >src/rmgroup.sh <<'*-*-END-of-src/rmgroup.sh-*-*'
-: '@(#)rmgroup.sh	1.6	9/19/86'
-for group
-do
-	echo "Removing newsgroup $group"
-	qgrp="`echo $group | sed 's/\./\\\./g'`"
-	if
-		grep -s "^$qgrp " LIBDIR/active
-	then
-		cat << E_O_F >/tmp/$$
-/^$qgrp[ 	]/d
-w
-q
-E_O_F
-		ed - LIBDIR/active < /tmp/$$
-		ed - LIBDIR/newsgroups < /tmp/$$
-		dir=SPOOLDIR/"`echo $group | sed 's/\./\//g'`"
-		if [ -d $dir ]
-		then
-			rm $dir/*
-			rmdir $dir
-		else
-			echo "$0: $dir: no spool directory" 2>&1
-		fi
-	else
-		echo "$0: $group: no such newsgroup" 2>&1
-	fi
-done
-rm -f /tmp/$$
-exit 0
*-*-END-of-src/rmgroup.sh-*-*
echo x - src/localize.vms 1>&2
sed 's/.//' >src/localize.vms <<'*-*-END-of-src/localize.vms-*-*'
-rm -f Makefile
-cp Makefile.dst Makefile
-chmod u+w Makefile
-ed - Makefile  <<'EOF'
-g/^#V7 /d
-g/^#USG /d
-g/^#VMS /s///
-g/#NOTVMS/d
-g/^#BSD4_[123] /d
-g/chgrp /d
-w
-q
-EOF
-rm -f defs.h
-cp defs.dist defs.h
-chmod u+w defs.h
-# ed - defs.h <<'EOF'
-# w
-# q
-# EOF
*-*-END-of-src/localize.vms-*-*
echo x - src/localize.usg 1>&2
sed 's/.//' >src/localize.usg <<'*-*-END-of-src/localize.usg-*-*'
-rm -f Makefile
-cp Makefile.dst Makefile
-chmod u+w Makefile
-ed - Makefile  <<'EOF'
-g/^#USG /s///
-g/^#V7 /d
-g/^#VMS /d
-g/^#BSD4_[123] /d
-g/termlib/s//curses/
-w
-q
-EOF
-rm -f defs.h
-cp defs.dist defs.h
-chmod u+w defs.h
-# ed - defs.h <<'EOF'
-# w
-# q
-# EOF
*-*-END-of-src/localize.usg-*-*
echo x - src/localize.v7 1>&2
sed 's/.//' >src/localize.v7 <<'*-*-END-of-src/localize.v7-*-*'
-rm -f Makefile
-cp Makefile.dst Makefile
-chmod u+w Makefile
-ed - Makefile  <<'EOF'
-g/^#V7 /s///
-g/^#USG /d
-g/^#VMS /d
-g/^#BSD4_[123] /d
-w
-q
-EOF
-rm -f defs.h
-cp defs.dist defs.h
-chmod u+w defs.h
-# ed - defs.h <<'EOF'
-# w
-# q
-# EOF
*-*-END-of-src/localize.v7-*-*
exit