[net.sources] 2.7-2.8.e

ARPAVAX:usenet (06/22/82)

	ed - Makefile.usg << '-*-END-*-'
	15c
	IOBJECTS = inews.o ifuncs.o iextern.o control.o fullname.o $(OBJECTS)
	.
	1c
	# @(#) Makefile.usg	2.5	6/21/82
	.
	w
	q
	-*-END-*-
	ed - Makefile.v7 << '-*-END-*-'
	15c
	IOBJECTS = inews.o ifuncs.o iextern.o control.o fullname.o $(OBJECTS)
	.
	1c
	# @(#) Makefile.v7	2.5	6/21/82
	.
	w
	q
	-*-END-*-
	ed - checknews.c << '-*-END-*-'
	153c
		ptr = getenv("NEWSRC");
		if (ptr == NULL)
			sprintf(newsrc, "%s/%s", userhome, NEWSRC);
		else
			strcpy(newsrc, ptr);
	.
	5c
	static char *SccsId = "@(#) checknews.c	2.9	6/21/82";
	.
	w
	q
	-*-END-*-
	ed - control.c << '-*-END-*-'
	706a
		} else if (strcmp(msg, "version") == 0) {
			return;	/* no restrictions */
	.
	699c
			suser();
	.
	663a
		for (p=sendto; *p; p++) {
			if (*p == ' ') {
				*p = 0;
				break;
			}
		}
	.
	658a
		register char *p;
	.
	8c
	static char *SccsId = "@(#) control.c	2.9	6/21/82 (this is NOT the netnews version!)";
	.
	w
	q
	-*-END-*-
	ed - defs.h << '-*-END-*-'
	32a
	/* #define LOCALNAME 		/* There is no full name database. 	*/
	.
	13c
	static char *news_version = "@(#) defs.h	2.8	6/21/82";
	.
	w
	q
	-*-END-*-
	ed - expire.c << '-*-END-*-'
	195c
				strcpy(newgroup, artlist);
				p = index(newgroup, '/');
				*p = 0;
				if (mkdir(newgroup) == 0)
	.
	168a
		char newgroup[BUFLEN];
	.
	6c
	static char *SccsId = "@(#) expire.c	2.10	6/21/82";
	.
	w
	q
	-*-END-*-
	ed - help << '-*-END-*-'
	20a
	v		Version.  Print current news version number.
	.
	6a
	u		Unsubscribe.  You won't be shown this newsgroup anymore.
	.
	w
	q
	-*-END-*-
	ed - ifuncs.c << '-*-END-*-'
	547a
	}

	char *
	gensender(logname)
	char *logname;
	{
		char *fn;
		static char buf[100];
		char buf2[100];
		char *fullname(), *getenv();
		char *p;
		int fd;

		fn = getenv("NAME");

		if (fn == NULL) {
			sprintf(buf, "%s/%s", getenv("HOME"), ".name");
			fd = open(buf, 0);
			if (fd >= 0) {
				read(fd, buf2, sizeof buf2);
				close(fd);
				if (buf2[0] >= 'A')
					fn = buf2;
				for (p=fn; *p; p++)
					if (*p < ' ')
						*p = 0;
			}
		}

		if (fn == NULL)
			fn = fullname(logname);

		sprintf(buf, "%s (%s)", logname, fn);
		return buf;
	.
	434,502d
	287a
		idunlock();
	.
	5c
	static char *SccsId = "@(#) ifuncs.c	2.11	6/21/82";
	.
	w
	q
	-*-END-*-
	ed - inews.c << '-*-END-*-'
	260c
				sprintf(bfr, "Article %s group %s not subscribed to",header.ident,header.nbuf);
	.
	211c
			if (i != 0)
	.
	201c
		if (!Dflag && mode != PROC) {
	.
	5c
	static char *SccsId = "@(#) inews.c	2.10	6/21/82";
	.
	w
	q
	-*-END-*-
	ed - postnews.usg << '-*-END-*-'
	27c
			if inews -t "$title" -n $ng <$t
			then
				:
			else
				if cat $t >>$HOME/dead.news
				then
					echo Article saved in $HOME/dead.news
				fi
			fi
	.
	1c
	: '@(#) postnews.usg	2.5	6/21/82'
	.
	w
	q
	-*-END-*-
	ed - postnews.v7 << '-*-END-*-'
	27c
			if inews -t "$title" -n $ng <$t
			then
				:
			else
				if cat $t >>$HOME/dead.news
				then
					echo Article saved in $HOME/dead.news
				fi
			fi
	.
	19c
		if test x$EDITOR = x
	.
	1c
	: '@(#) postnews.v7	2.5	6/21/82'
	.
	w
	q
	-*-END-*-
	ed - readnews.c << '-*-END-*-'
	119c
			sprintf(newsrc, "%s/%s", userhome, myrc);
		}
		else {
			strcpy(newsrc, myrc);
		}
	.
	117c
		if (myrc == NULL) {
	.
	5c
	static char *SccsId = "@(#) readnews.c	2.6	6/21/82";
	.
	w
	q
	-*-END-*-
	ed - readr.c << '-*-END-*-'
	448a
				ptr1 = index(tfilename, '(');
				if (ptr1) {
					while (ptr1[-1] == ' ')
						ptr1--;
					*ptr1 = 0;
				}
	.
	428a
					fp = NULL;
	.
	424c
				if (!cancel(ofp, hptr, i) && hptr == &h) {
	.
	5c
	static char *SccsId = "@(#) readr.c	2.11	6/21/82";
	.
	w
	q
	-*-END-*-
	ed - rfuncs.c << '-*-END-*-'
	150,151c
				fname = ptr = index(h.path, '(');
				while (ptr && ptr[-1] == ' ')
					ptr--;
				if (ptr)
					*ptr = 0;
				fname++;
				ptr = fname+strlen(fname)-1;
				if (*ptr == ')')
					*ptr = 0;
				fprintf(ofp, "From %s %s\n", h.path, h.subdate);
				if (fname)
					fprintf(ofp, "Full-Name: %s\n", fname);
				fprintf(ofp, "Newsgroups: %s\n", h.nbuf);
				fprintf(ofp, "Subject: %s\n", h.title);
				fprintf(ofp, "Article-ID: %s/%d\n\n", groupdir, bit);
	.
	128c
		register char *ptr, *fname;
	.
	5c
	static char *SccsId = "@(#) rfuncs.c	2.7	6/21/82";
	.
	w
	q
	-*-END-*-
	cat > fullname.c << '-*-END-*-'
	/*
	 * 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.
	 */

	static char *sccsid = "%W%	%G%";

	#include <stdio.h>
	#include <ctype.h>
	#include <pwd.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[100];
		struct passwd *pw, *getpwnam();

		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[100];
		char fbuf[100];
		FILE *fd;
		char *p, *index();

		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;
		sprintf(fbuf, "%s/%s", getenv("HOME"), ".name");
		fd = fopen(fbuf, "w");
		fprintf(fd, "%s\n", inbuf);
		fclose(fd);
		return inbuf;
	}
	#endif

	/*
	**  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 == '&')
			{
				(void) strcpy(bp, login);
				if (islower(*bp))
					*bp = toupper(*bp);
				while (*bp != '\0')
					bp++;
				p++;
			}
			else
				*bp++ = *p++;
		}
		*bp = '\0';
	}
	-*-END-*-