#! /bin/sh
# Make a new directory for the rn sources, cd to it, and run kits 1 thru 11 
# through sh.  When all 11 kits have been run, read README.

echo "This is rn kit 10 (of 11).  If kit 10 is complete, the line"
echo '"'"End of kit 10 (of 11)"'" will echo at the end.'
echo ""
export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
echo Extracting only.c
cat >only.c <<'!STUFFY!FUNK!'
/* $Id: only.c,v 4.4 1991/09/09 20:23:31 sob Exp sob $
 *
 * $Log: only.c,v $
 * Revision 4.4  1991/09/09  20:23:31  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#include "EXTERN.h"
#include "common.h"
#include "search.h"
#include "util.h"
#include "final.h"
#include "ngsrch.h"
#include "INTERN.h"
#include "only.h"

void
only_init()
{
    ;
}

void
setngtodo(pat)
char *pat;
{
    char *s;

#ifdef ONLY
    if (!*pat)
	return;
    if (maxngtodo < NGMAX) {
	ngtodo[maxngtodo] = savestr(pat);
#ifdef SPEEDOVERMEM
#ifndef lint
	compextodo[maxngtodo] = (COMPEX*)safemalloc(sizeof(COMPEX));
#endif /* lint */
	init_compex(compextodo[maxngtodo]);
	compile(compextodo[maxngtodo],pat,TRUE,TRUE);
	if ((s = ng_comp(compextodo[maxngtodo],pat,TRUE,TRUE)) != Nullch) {
					    /* compile regular expression */
	    printf("\n%s\n",s) FLUSH;
	    finalize(1);
	}
#endif
	maxngtodo++;
    }
#else
    notincl("o");
#endif
}

/* if command line list is non-null, is this newsgroup wanted? */

bool
inlist(ngnam)
char *ngnam;
{
#ifdef ONLY
    register int i;
#ifdef SPEEDOVERMEM

    if (maxngtodo == 0)
	return TRUE;
    for (i=0; i<maxngtodo; i++) {
	if (execute(compextodo[i],ngnam))
	    return TRUE;
    }
    return FALSE;
#else
    COMPEX ilcompex;
    char *s;

    if (maxngtodo == 0)
	return TRUE;
    init_compex(&ilcompex);
    for (i=0; i<maxngtodo; i++) {
	if ((s = ng_comp(&ilcompex,ngtodo[i],TRUE,TRUE)) != Nullch) {
					    /* compile regular expression */
	    printf("\n%s\n",s) FLUSH;
	    finalize(1);
	}
	
	if (execute(&ilcompex,ngnam) != Nullch) {
	    free_compex(&ilcompex);
	    return TRUE;
	}
    }
    free_compex(&ilcompex);
    return FALSE;
#endif
#else
    return TRUE;
#endif
}

#ifdef ONLY
void
end_only()
{
    if (maxngtodo) {			/* did they specify newsgroup(s) */
	int whicharg;

#ifdef VERBOSE
	IF(verbose)
	    printf("\nRestriction %s%s removed.\n",ngtodo[0],
		maxngtodo > 1 ? ", etc." : nullstr) FLUSH;
	ELSE
#endif
#ifdef TERSE
	    fputs("\nExiting \"only\".\n",stdout) FLUSH;
#endif
	for (whicharg = 0; whicharg < maxngtodo; whicharg++) {
	    free(ngtodo[whicharg]);
#ifdef SPEEDOVERMEM
	    free_compex(compextodo[whicharg]);
#ifndef lint
	    free((char*)compextodo[whicharg]);
#endif /* lint */
#endif
	}
	maxngtodo = 0;
    }
}
#endif
!STUFFY!FUNK!
echo Extracting getactive.c
cat >getactive.c <<'!STUFFY!FUNK!'
/* $Id: getactive.c,v 4.4 1991/09/09 20:18:23 sob Exp sob $
 *
 * $Log: getactive.c,v $
 * Revision 4.4  1991/09/09  20:18:23  sob
 * release 4.4
 *
 *
 * 
 *
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */
#include <stdio.h>
#include "config.h"
#include <signal.h>
/* what to do with ansi prototypes -- '()' == ignore, 'x' == use */
#ifndef ANSI
#   define ANSI(x) ()
#endif
#include "INTERN.h"
#ifdef SERVER
#include "server.h"
#endif

main(argc, argv)
	int		argc;
	char	 	*argv[];
{
	char		ser_line[NNTP_STRLEN];
	char		command[32];
	int		response;
	char 		*action;
	register char	*server;
	register FILE	*actfp;

	if (argc < 2 || argc > 3) {
		fprintf(stderr, "Usage: getactive [active|distributions|newsgroups] filename\n");
		exit(1);
	}
	if (argc == 2) action = "ACTIVE";
	else{
		 action = argv[1];
		 argc--;
		 argv++;
	}
	server = getserverbyfile(SERVER_FILE);
	if (server == NULL) {
		fprintf(stderr, "Couldn't get name of news server from %s\n",
			SERVER_FILE);
		fprintf(stderr,
	  "Either fix this file, or put NNTPSERVER in your environment.\n");
		exit(1);
	}

	response = server_init(server);
	if (response < 0) {
		fprintf(stderr,
			"getactive: Can't get %s file from server %s.\n",
				action, server);
		exit(1);
	}

	if (handle_server_response(response, server) < 0)
		exit(1);

	sprintf(command,"LIST %s",action);
	put_server(command); 
#ifdef HAVESIGHOLD
 	sighold(SIGINT);
#endif
	(void) get_server(ser_line, sizeof(ser_line));
	if (*ser_line != CHAR_OK) {		/* and then see if that's ok */
		fprintf(stderr,
			"getactive: Can't get %s file from server.\n",action);
		fprintf(stderr, "Server said: %s\n", ser_line);
		exit(1);
	}

	actfp = fopen(argv[1], "w");		/* and get ready */
	if (actfp == NULL) {
		close_server();
		perror(argv[1]);
		exit(1);
	}

	while (get_server(ser_line, sizeof(ser_line)) >= 0) {  /* while */
		if (ser_line[0] == '.')		/* there's another line */
			break;			/* get it and write it to */
		if (actfp != NULL) {		/* the temporary active file */
			fputs(ser_line, actfp);
			putc('\n', actfp);
		}
	}

	if (ferror(actfp)) {
	     perror(argv[1]);
	     exit(1);
	}

	if (fclose(actfp) == EOF) {
	     perror(argv[1]);
	     exit(1);
	}

#ifdef HAVESIGHOLD

	exit(0);
	sigrelse(SIGINT);
#endif
	close_server();
	exit(0);
}
!STUFFY!FUNK!
echo Extracting backpage.c
cat >backpage.c <<'!STUFFY!FUNK!'
/* $Id: backpage.c,v 4.4 1991/09/09 20:18:23 sob Exp sob $
 *
 * $Log: backpage.c,v $
 * Revision 4.4  1991/09/09  20:18:23  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#include "EXTERN.h"
#include "common.h"
#include "intrp.h"
#include "final.h"
#include "INTERN.h"
#include "backpage.h"

ART_LINE maxindx = -1;
long lseek();

void
backpage_init()
{
    char *varyname;
    
    varyname = filexp(VARYNAME);
    close(creat(varyname,0600));
    varyfd = open(varyname,2);
    UNLINK(varyname);
    if (varyfd < 0) {
	printf(cantopen,varyname) FLUSH;
	sig_catcher(0);
    }
    
}

/* virtual array read */

ART_POS
vrdary(indx)
ART_LINE indx;
{
    int subindx;
    long offset;

#ifdef DEBUGGING
    if (indx > maxindx) {
	printf("vrdary(%ld) > %ld\n",(long)indx, (long)maxindx) FLUSH;
	return 0;
    }
#endif
    if (indx < 0)
	return 0;
    subindx = indx % VARYSIZE;
    offset = (indx - subindx) * sizeof(varybuf[0]);
    if (offset != oldoffset) {
	if (oldoffset >= 0) {
#ifndef lint
	    (void)lseek(varyfd,oldoffset,0);
	    write(varyfd, (char *)varybuf,sizeof(varybuf));
#endif /* lint */
	}
#ifndef lint
	(void)lseek(varyfd,offset,0);
	read(varyfd,(char *)varybuf,sizeof(varybuf));
#endif /* lint */
	oldoffset = offset;
    }
    return varybuf[subindx];
}

/* write to virtual array */

void
vwtary(indx,newvalue)
ART_LINE indx;
ART_POS newvalue;
{
    int subindx;
    long offset;

#ifdef DEBUGGING
    if (indx < 0)
	printf("vwtary(%ld)\n",(long)indx) FLUSH;
    if (!indx)
	maxindx = 0;
    if (indx > maxindx) {
	if (indx != maxindx + 1)
	    printf("indx skipped %d-%d\n",maxindx+1,indx-1) FLUSH;
	maxindx = indx;
    }
#endif
    subindx = indx % VARYSIZE;
    offset = (indx - subindx) * sizeof(varybuf[0]);
    if (offset != oldoffset) {
	if (oldoffset >= 0) {
#ifndef lint
	    (void)lseek(varyfd,oldoffset,0);
	    write(varyfd,(char *)varybuf,sizeof(varybuf));
#endif /* lint */
	}
#ifndef lint
	(void)lseek(varyfd,offset,0);
	read(varyfd,(char *)varybuf,sizeof(varybuf));
#endif /* lint */
	oldoffset = offset;
    }
    varybuf[subindx] = newvalue;
}

!STUFFY!FUNK!
echo Extracting makedepend.SH
cat >makedepend.SH <<'!STUFFY!FUNK!'
case $CONFIG in
    '') . ./config.sh ;;
esac
echo "Extracting makedepend (with variable substitutions)"
$spitshell >makedepend <<!GROK!THIS!
$startsh
# $Id: makedepend.SH,v 4.4 1991/09/09 20:23:31 sob Exp sob $
#
# $Log: makedepend.SH,v $
# Revision 4.4  1991/09/09  20:23:31  sob
# release 4.4
#
# 
# This software is Copyright 1991 by Stan Barber. 
#
# 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 of 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. 
export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)

$cat /dev/null >.deptmp
$echo "(Note: this is going to take a while.)"
$rm -f X*.c
for file in *.c; do
    filebase=\`basename \$file .c\`
    $echo "Finding dependencies for \$filebase.o."
    $sed -n <\$file >X\$file \\
	-e "/^\${filebase}_init(/q" \\
	-e '/^#/{' \\
	-e 's|/\*.*$||' \\
	-e p \\
	-e '}'
    $cpp -I/usr/local/include X\$file | $sed  \\
	-e '/^# *line/s/line//' \
	-e '/^# *[0-9]/!d' \\
	-e 's/^.*"\(.*\)".*\$/'\$filebase'.o: \1/' \\
	-e 's|: \./|: |' \\
	-e 's|: X|: |' | \\
	$uniq | $sort | $uniq >> .deptmp
done

for file in *.SH; do
    $echo \`basename \$file .SH\`: \$file config.sh \; /bin/sh \$file >> .deptmp
done

$sed <Makefile >Makefile.new -e '1,/^# AUTOMATICALLY/!d'

if $test -s .deptmp; then
    echo "Updating Makefile..."
    echo "# If this runs make out of memory, delete /usr/include lines." >>Makefile.new
    $sed -e 's/\\\$/\$\$/g' .deptmp >>Makefile.new
else
    $echo "You don't seem to have a proper C preprocessor.  Using grep instead."
    $egrep '^#include ' *.c *.h >.deptmp
    echo "Updating Makefile..."
    <.deptmp $sed -n 's|c:#include "\(.*\)".*\$\$|o: \1|p' >> Makefile.new
    <.deptmp $sed -n 's|c:#include <\(.*\)>.*\$\$|o: /usr/include/\1|p' >> Makefile.new
    <.deptmp $sed -n 's|h:#include "\(.*\)".*\$\$|h: \1|p' >> Makefile.new
    <.deptmp $sed -n 's|h:#include <\(.*\)>.*\$\$|h: /usr/include/\1|p' >> Makefile.new
fi
$mv Makefile Makefile.old
$mv Makefile.new Makefile
$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
rm .deptmp X*.c

!GROK!THIS!
$eunicefix makedepend
chmod 755 makedepend
!STUFFY!FUNK!
echo Extracting bits.h
cat >bits.h <<'!STUFFY!FUNK!'
/* $Id: bits.h,v 4.4 1991/09/09 20:18:23 sob Exp sob $
 *
 * $Log: bits.h,v $
 * Revision 4.4  1991/09/09  20:18:23  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT char *ctlarea INIT(Nullch);	/* one bit for each article in current newsgroup */
			/* with the following interpretation: */
			/*	0 => unread  */
			/*	1 => read    */

/* if subscripting is faster than shifting on your machine, define this */
#undef USESUBSCRIPT
#ifdef USESUBSCRIPT
EXT char powerof2[] INIT({1,2,4,8,16,32,64,128});
#define pow2(x) powerof2[x]
#else
#define pow2(x) (1 << (x))
#endif

#ifdef lint
EXT bool nonesuch INIT(FALSE);
#define ctl_set(a)
#define ctl_clear(a)
#define ctl_read(a) nonesuch
#define was_read(a) nonesuch
#else
#define ctl_set(a) (ctlarea[(OFFSET(a)) / BITSPERBYTE] |= pow2((OFFSET(a)) % BITSPERBYTE))
#define ctl_clear(a) (ctlarea[(OFFSET(a)) / BITSPERBYTE] &= ~pow2((OFFSET(a)) % BITSPERBYTE))
#define ctl_read(a) ((ctlarea[(OFFSET(a)) / BITSPERBYTE] & pow2((OFFSET(a)) % BITSPERBYTE)) != 0)

#define was_read(a) ((a)<firstbit || ctl_read(a))
#endif /* lint */

EXT ART_NUM absfirst INIT(0);	/* 1st real article in current newsgroup */
EXT ART_NUM firstart INIT(0);	/* minimum unread article number in newsgroup */
EXT ART_NUM firstbit INIT(0);	/* minimum valid bit, usually == firstart */
EXT ART_NUM lastart INIT(0);	/* maximum article number in newsgroup */

#ifdef DELAYMARK
EXT FILE *dmfp INIT(Nullfp);
EXT char *dmname INIT(Nullch);
EXT int dmcount INIT(0);
#endif

void	bits_init ANSI((void));
void	checkpoint_rc ANSI((void));
void	restore_ng ANSI((void));
void	onemore ANSI((ART_NUM));
void	oneless ANSI((ART_NUM));
void	unmark_as_read ANSI((void));
void	delay_unmark ANSI((ART_NUM));
void	mark_as_read ANSI((void));
void	check_first ANSI((ART_NUM));
#ifdef DELAYMARK
    void	yankback ANSI((void));
#endif
int	chase_xrefs ANSI((ART_NUM,int));
int	initctl ANSI((void));
void	grow_ctl ANSI((ART_NUM));
!STUFFY!FUNK!
echo Extracting newsgroups.1
cat >newsgroups.1 <<'!STUFFY!FUNK!'
.\" $Id: newsgroups.1,v 4.4.3.1 1992/02/01 03:17:20 sob PATCH_3 sob $
.\" 
.\" $Log: newsgroups.1,v $
.\" Revision 4.4.3.1  1992/02/01  03:17:20  sob
.\" Version 4.4 Patchlevel 3
.\"
.\" Revision 4.4.1.1  1991/09/25  19:36:48  sob
.\" Changed quote macro to "standard" one
.\"
.\" Revision 4.4  1991/09/09  20:23:31  sob
.\" release 4.4
.\"
.\"
.\" This software is Copyright 1991 by Stan Barber. 
.\"
.\" 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 of 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. 
.\" 
.\" 
.de Sh
.br
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
.\"
.\"     Set up \*(-- to give an unbreakable dash;
.\"     string Tr holds user defined translation string.
.\"     Bell System Logo is used as a dummy character.
.\"
.ie n \{\
.tr \(bs-\*(Tr
.ds -- \(bs-
.if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
.ds L' '
.ds R' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds L' `
.ds R' '
'br\}
.TH NEWSGROUPS 1 LOCAL
.SH NAME
newsgroups - a program to list unsubscribed newsgroups.
.SH SYNOPSIS
.B newsgroups pattern flag
.SH DESCRIPTION
The
.I newsgroups
program compares your .newsrc file with the file of active newsgroups,
and prints a list of unsubscribed newsgroups matching pattern.
If the second argument \*(L"flag\*(R" is present, only newsgroups not
found in your .newsrc are listed, and the display is not paged.
If the second argument is missing, the display is paged, and an additional
list of unsubscribed newsgroups occurring in your .newsrc is printed.
.SH ENVIRONMENT
.IP DOTDIR 8
Where to find your .newsrc, if not in your home directory.
.Sp
Default: $HOME
.IP HOME 8
Your home directory.
.Sp
Default: $LOGDIR
.IP LOGDIR 8
Your home directory if HOME is undefined.
.SH FILES
/usr/lib/news/active or a reasonable facsimile
.br
${DOTDIR-{$HOME-$LOGDIR}}/.newsrc
.SH SEE ALSO
rn(1), newsrc(5)
.SH DIAGNOSTICS
.SH BUGS
The flag argument is a kludge.
!STUFFY!FUNK!
echo Extracting ndir.c
cat >ndir.c <<'!STUFFY!FUNK!'
/* $Id: ndir.c,v 4.4 1991/09/09 20:23:31 sob Exp sob $
 *
 * $Log: ndir.c,v $
 * Revision 4.4  1991/09/09  20:23:31  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#include "EXTERN.h"
#include "common.h"
#include "INTERN.h"
#include "ndir.h"

#ifdef USENDIR
/*
 * support for Berkeley directory reading routine on a V7 file system
 */

/*
 * open a directory.
 */
DIR *
opendir(name)
char *name;
{
	register DIR *dirp;
	register int fd;
	char *malloc();

	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
 */
#ifndef pyr
#define	ODIRSIZ	14

struct	olddirect {
	ino_t	od_ino;
	char	od_name[ODIRSIZ];
};
#else	/* an Pyramid in the ATT universe */
#define	ODIRSIZ	248

struct	olddirect {
	long	od_ino;
	short	od_fill1, od_fill2;
	char	od_name[ODIRSIZ];
};
#endif

/*
 * 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(dirp);
}

#endif /* USENDIR */
!STUFFY!FUNK!
echo Extracting newsetup.1
cat >newsetup.1 <<'!STUFFY!FUNK!'
.\" $Id: newsetup.1,v 4.4.3.1 1992/02/01 03:17:20 sob PATCH_3 sob $
.\" 
.\" $Log: newsetup.1,v $
.\" Revision 4.4.3.1  1992/02/01  03:17:20  sob
.\" Version 4.4 Patchlevel 3
.\"
.\" Revision 4.4.1.1  1991/09/25  19:36:48  sob
.\" Changed quote macro to "standard" one
.\"
.\" Revision 4.4  1991/09/09  20:23:31  sob
.\" release 4.4
.\"
.\"
.\" This software is Copyright 1991 by Stan Barber. 
.\"
.\" 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 of 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. 
.\" 
.\" 
.de Sh
.br
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
.\"
.\"     Set up \*(-- to give an unbreakable dash;
.\"     string Tr holds user defined translation string.
.\"     Bell System Logo is used as a dummy character.
.\"
.ie n \{\
.tr \(bs-\*(Tr
.ds -- \(bs-
.if (\n(.H=4u)&(1m=24u) .ds -- \(bs\h'-12u'\(bs\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(bs\h'-12u'\(bs\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
.ds L' '
.ds R' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds L' `
.ds R' '
'br\}
.TH NEWSETUP 1 LOCAL
.SH NAME
newsetup - a program to set up a .newsrc file
.SH SYNOPSIS
.B newsetup
.SH DESCRIPTION
The
.I newsetup
program creates a new .newsrc file containing all of the currently active
newsgroups.
It tries to put them in a reasonable order, i.e. local newsgroups earlier,
but you'll probably want to change the ordering anyway (if you use
.IR rn )
in order to put interesting newsgroups first.
If you already have a .newsrc, it will be backed up with the name
\*(L".oldnewsrc\*(R".
.SH ENVIRONMENT
.IP DOTDIR 8
Where to put your .newsrc, if not in your home directory.
.Sp
Default: $HOME
.IP HOME 8
Your home directory.
.Sp
Default: $LOGDIR
.IP LOGDIR 8
Your home directory if HOME is undefined.
.SH FILES
/usr/lib/news/active or a reasonable facsimile
.br
${DOTDIR-{$HOME-$LOGDIR}}/.newsrc
.SH SEE ALSO
rn(1), newsrc(5)
.SH DIAGNOSTICS
.SH BUGS
!STUFFY!FUNK!
echo Extracting rcstuff.h
cat >rcstuff.h <<'!STUFFY!FUNK!'
/* $Id: rcstuff.h,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 *
 * $Log: rcstuff.h,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4.2.1  1991/12/01  18:05:42  sob
 * Patchlevel 2 changes
 *
 * Revision 4.4  1991/09/09  20:27:37  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT char **rcline INIT(NULL);/* pointers to lines of .newsrc */
EXT ART_UNREAD *toread INIT(NULL);
			/* number of articles to be read in newsgroup */
			/* <0 => invalid or unsubscribed newsgroup */
#define TR_ONE ((ART_UNREAD) 1)
#define TR_NONE ((ART_UNREAD) 0)
#define TR_UNSUB ((ART_UNREAD) -1)
			/* keep this one as -1, some tests use >= TR_UNSUB */
#define TR_BOGUS ((ART_UNREAD) -2)
#define TR_JUNK ((ART_UNREAD) -3)

EXT char *rcchar INIT(NULL); /* holds the character : or ! while spot is \0 */
EXT char *rcnums INIT(NULL); /* offset from rcline to numbers on line */
EXT ACT_POS *softptr INIT(NULL);
			/* likely ptr to active file entry for newsgroup */
EXT bool paranoid INIT(FALSE);	/* did we detect some inconsistency in .newsrc? */
EXT int maxrcline INIT(0);	/* current maximum # of lines in .newsrc */
EXT int addnewbydefault INIT(0);

bool	rcstuff_init ANSI((void));
bool	get_ng ANSI((char *,bool_int));	/* return TRUE if newsgroup can be found or added */
NG_NUM	add_newsgroup ANSI((char *,char_int));
#ifdef RELOCATE
    NG_NUM	relocate_newsgroup ANSI((NG_NUM,NG_NUM));/* move newsgroup around */
#endif
void	list_newsgroups ANSI((void));
NG_NUM	find_ng ANSI((char *));	/* return index of newsgroup */
void	cleanup_rc ANSI((void));
void	sethash ANSI((NG_NUM));
int	hash ANSI((char *));
void	newsrc_check ANSI((void));
void	write_rc ANSI((void));
void	get_old_rc ANSI((void));
!STUFFY!FUNK!
echo Extracting ndir.h.SH
cat >ndir.h.SH <<'!STUFFY!FUNK!'
: create config.h file
echo "Extracting ndir.h (with variable substitutions)"
. ./config.sh
$cat <<EOT >ndir.h
/*
 * This file was produced by running the ndir.h.SH script, which
 * gets its values from config.sh, which is generally produced by
 * running Configure.
 */
/* $Id: ndir.h.SH,v 4.4 1991/09/09 20:23:31 sob Exp $
 *
 * $Log: ndir.h.SH,v $
 *Revision 4.4  1991/09/09  20:23:31  sob
 *release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#ifdef LIBNDIR
#   include <ndir.h>
#else
#   ifndef USENDIR
#	include $dirinc
#   else

#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.
 */
#undef 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 ANSI((char *));
extern	struct direct *readdir ANSI((DIR *));
extern	long telldir ANSI((DIR *));
extern	void seekdir ANSI((DIR *));
#define rewinddir(dirp)	seekdir((dirp), (long)0)
extern	void closedir ANSI((DIR *));

#   endif
#endif
EOT
!STUFFY!FUNK!
echo Extracting last.c
cat >last.c <<'!STUFFY!FUNK!'
/* $Id: last.c,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 *
 * $Log: last.c,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4  1991/09/09  20:23:31  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#include "EXTERN.h"
#include "common.h"
#include "rn.h"
#include "util.h"
#include "intrp.h"
#include "INTERN.h"
#include "last.h"

char *lastname = Nullch;	/* path name of .rnlast file */

void
last_init(tcbuf)
char *tcbuf;
{
    lastname = savestr(filexp(LASTNAME));
    if ((tmpfp = fopen(lastname,"r")) != Nullfp &&
	fgets(tcbuf,1024,tmpfp) != Nullch) {
	tcbuf[strlen(tcbuf)-1] = '\0';
	lastngname = savestr(tcbuf);
	fgets(tcbuf,1024,tmpfp);
	lasttime = atol(tcbuf);
	fgets(tcbuf,1024,tmpfp);
	lastactsiz = atol(tcbuf);
	if (fgets(tcbuf,1024,tmpfp) != Nullch)
	    lastnewtime = atol(tcbuf);
	else
	    lastnewtime = (lasttime? lasttime : time(Null(time_t*))-24L*60*60);
	if (fgets(tcbuf,1024,tmpfp) != Nullch)
	    lastnewsize = atol(tcbuf);
	else
	    lastnewsize = 0;
	fclose(tmpfp);
    }
    else {
	lastngname = nullstr;
	lasttime = 0;
	lastactsiz = 0;
	lastnewsize = 0;
	/* Use yesterday as an initial value for finding new groups. */
	lastnewtime = time(Null(time_t*)) - 24L*60*60;
    }
}

/* put out certain values for next run of rn */

void
writelast()
{
    if ((tmpfp = fopen(lastname,"w")) != Nullfp) {
	fprintf(tmpfp,"%s\n%ld\n%ld\n%ld\n%ld\n",
	    (ngname==Nullch?nullstr:ngname),(long)lasttime,(long)lastactsiz,
	    (long)lastnewtime,(long)lastnewsize);
	fclose(tmpfp);
    }
    else
	printf(cantcreate,lastname) FLUSH;
}
!STUFFY!FUNK!
echo Extracting newsnews.SH
cat >newsnews.SH <<'!STUFFY!FUNK!'
: see end of file for revision information
case $CONFIG in
    '') . ./config.sh ;;
esac
echo "Extracting newsnews (with variable substitutions)"
cat >newsnews <<!GROK!THIS!
			*** NEWS NEWS ***

Welcome to rn.  There are more options to rn than you want to think about, so
we won't list them here.  If you want to find out about them, read the manual
page(s).  There are some important things to remember, though:

  * Rn is not a modified readnews.  Don't expect the commands to be identical.
  * Rn runs in cbreak mode.  This means you don't have to type carriage return
    on single character commands.  (There are some multi-character commands.)
  * At ANY prompt in rn, you may type 'h' for help.  There are many different
    help menus, depending on where you are in rn.  Typing <esc>h in the
    middle of a multi-character command will list escape substitutions.
  * Typing a space to any prompt means to do the normal thing.  You could
    spend all day reading news and never hit anything but the space bar.

This particular message comes from $rnlib/newsnews.  You will only
see it once.  Your news administrator should feel free to substitute his or
her own message whenever something new happens to rn, and then the file
will again be displayed, just once for each person.

Stan Barber	uunet!bcm!lib.tmc.edu!rrn  rrn@lib.tmc.edu
!GROK!THIS!
$eunicefix newsnews
#
# $Id: newsnews.SH,v 4.4 1991/09/09 20:23:31 sob Exp sob $
# 
# $Log: newsnews.SH,v $
# Revision 4.4  1991/09/09  20:23:31  sob
# release 4.4
#
#
#
# This software is Copyright 1991 by Stan Barber. 
#
# 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 of 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. 

!STUFFY!FUNK!
echo Extracting autosub.c
cat >autosub.c <<'!STUFFY!FUNK!'
/*
 * $Id: autosub.c,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 *
 * $Log: autosub.c,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4  1991/09/09  20:18:23  sob
 * release 4.4
 *
 *
 *
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#include "EXTERN.h"
#include "common.h"
#include "search.h"
#include "ngsrch.h"
#include "util.h"
#include "INTERN.h"
#include "autosub.h"

/* Consider the newsgroup specified, and return:	*/
/* : if we should autosubscribe to it			*/
/* ! if we should autounsubscribe to it			*/
/* \0 if we should ask the user.			*/
int
auto_subscribe(ng)
char *ng;
{
    char *s;

    if((s = getval("AUTOSUBSCRIBE", (char *)NULL))
	&& matchlist(s, ng)) return ':';
    if((s = getval("AUTOUNSUBSCRIBE", (char *)NULL))
	&& matchlist(s, ng)) return '!';
    return 0;
}

bool
matchlist(patlist, s)
char *patlist;
char *s;
{
    COMPEX ilcompex;
    char *p;
    char *err;
    bool result;
    bool tmpresult;

    result = FALSE;
    init_compex(&ilcompex);
    while(patlist && *patlist) {

	if(*patlist == '!') {
		patlist++;
		tmpresult = FALSE;
	} else tmpresult = TRUE;

	if(p = index(patlist, ',')) *p = '\0';
        /* compile regular expression */
	err = ng_comp(&ilcompex,patlist,TRUE,TRUE);
	if(p) *p++ = ',';

	if(err != Nullch) {
	    printf("\n%s\n", err) FLUSH;
	    finalize(1);
	}
	
	if (execute(&ilcompex,s) != Nullch)
	    result = tmpresult;
	patlist = p;
    }
    free_compex(&ilcompex);
    return result;
}
!STUFFY!FUNK!
echo Extracting search.h
cat >search.h <<'!STUFFY!FUNK!'
/* $Id: search.h,v 4.4 1991/09/09 20:27:37 sob Exp sob $
 *
 * $Log: search.h,v $
 * Revision 4.4  1991/09/09  20:27:37  sob
 * release 4.4
 *
 *
 *
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#ifndef NBRA
#define	NBRA	10		/* the maximum number of meta-brackets in an
				   RE -- \( \) */
#define NALTS	10		/* the maximum number of \|'s */
 
typedef struct {	
    char *expbuf;		/* The compiled search string */
    int eblen;			/* Length of above buffer */
    char *alternatives[NALTS];	/* The list of \| seperated alternatives */
    char *braslist[NBRA];	/* RE meta-bracket start list */
    char *braelist[NBRA];	/* RE meta-bracket end list */
    char *brastr;		/* saved match string after execute() */
    char nbra;			/* The number of meta-brackets int the most
				   recenlty compiled RE */
    bool do_folding;		/* fold upper and lower case? */
} COMPEX;

void	search_init ANSI((void));
void	init_compex ANSI((COMPEX *));
void	free_compex ANSI((COMPEX *));
char	*getbracket ANSI((COMPEX *,int));
void	case_fold ANSI((int));
char	*compile ANSI((COMPEX *,char *,int,int)); 
void	grow_eb ANSI((COMPEX *));
char	*execute ANSI((COMPEX *,char *)); 
bool	advance ANSI((COMPEX *,char *,char *));
bool	backref ANSI((COMPEX *,int,char *)); 
bool	cclass ANSI((char *,int,int));
#endif
!STUFFY!FUNK!
echo Extracting util.h
cat >util.h <<'!STUFFY!FUNK!'
/* $Id: util.h,v 4.4 1991/09/09 20:27:37 sob Exp sob $
 *
 * $Log: util.h,v $
 * Revision 4.4  1991/09/09  20:27:37  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT bool waiting INIT(FALSE);	
			/* are we waiting for subprocess (in doshell)? */
EXT int len_last_line_got INIT(0);
			/* strlen of some_buf after */
			/*  some_buf = get_a_line(bufptr,buffersize,fp) */

/* is the string for makedir a directory name or a filename? */

#define MD_DIR 	0
#define MD_FILE 1

void	util_init ANSI((void));
int	doshell ANSI((char *,char *));
char	*safemalloc ANSI((MEM_SIZE));
char	*saferealloc ANSI((char *,MEM_SIZE));
char	*safecpy ANSI((char *,char *,int));
char	*safecat ANSI((char *,char *,int));
char	*cpytill ANSI((char *,char *,int));
char	*instr ANSI((char *,char *, int));
#ifdef SETUIDGID
    int		eaccess ANSI((char *,int));
#endif
char	*getwd ANSI((char *));
char	*get_a_line ANSI((char *,int,FILE *));
char	*savestr ANSI((char *));
int	makedir ANSI((char *,int));
void	setenv ANSI((char *,char *));
int	envix ANSI((char *));
void	notincl ANSI((char *));
char	*getval ANSI((char *,char *));
void	growstr ANSI((char **,int *,int));
void	setdef ANSI((char *,char *));
#ifdef SERVER
int	nntp_get ANSI((char *, int));
#endif
!STUFFY!FUNK!
echo Extracting kitlists.c
cat >kitlists.c <<'!STUFFY!FUNK!'
/* $Id$
 *
 * $Log$
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#include <stdio.h>
#ifdef USG
#define index strchr
#endif
#define MAXKIT 100
#define MAXKITSIZE 64000
#define KITOVERHEAD 700
#define FILEOVERHEAD 80

long tot[MAXKIT];
FILE *outfp[MAXKIT];		/* of course, not this many file descriptors */

main(argc,argv)
int argc;
char **argv;
{
    FILE *inp, *popen();
    char buf[1024], filnam[128];
    char *index();
    register char *s;
    register int i, newtot;
#ifdef USG    
    sprintf(buf,"ls -l `awk '{print $1}' <%s` | awk '{print $9 \" \" $5}' | sort -nr +1", argc > 1 ? argv[1] : "MANIFEST.new");
#else
    sprintf(buf,"ls -l `awk '{print $1}' <%s` | awk '{print $8 \" \" $4}' | sort +1nr", argc > 1 ? argv[1] : "MANIFEST.new");
#endif

    inp = popen(buf,"r");

    while (fgets(buf,1024,inp) != (char *)NULL) {
	s = index(buf,' ');
	*s++ = '\0';
	for (i=1;
	  (newtot = tot[i] + atol(s) + FILEOVERHEAD) > MAXKITSIZE-KITOVERHEAD;
	  i++) 
	    ;
	if (!tot[i]) {
	    sprintf(filnam,"kit%d.list",i);
	    outfp[i] = fopen(filnam,"w");
	}
	tot[i] = newtot;
	printf("Adding %s to kit %d giving %d bytes\n",buf,i,newtot);
	fprintf(outfp[i],"%s\n",buf);
    }
}
!STUFFY!FUNK!
echo Extracting artsrch.h
cat >artsrch.h <<'!STUFFY!FUNK!'
/* $Id: artsrch.h,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 *
 * $Log: artsrch.h,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4  1991/09/09  20:18:23  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#ifndef NBRA
#include "search.h"
#endif

#ifdef ARTSEARCH

#define SRCH_ABORT 0
#define SRCH_INTR 1
#define SRCH_FOUND 2
#define SRCH_NOTFOUND 3
#define SRCH_DONE 4
#define SRCH_SUBJDONE 5
#define SRCH_ERROR 6
#endif

EXT char *lastpat INIT(nullstr);	/* last search pattern */
#ifdef ARTSEARCH
    EXT COMPEX sub_compex;		/* last compiled subject search */
    EXT COMPEX art_compex;		/* last compiled normal search */
#   ifdef CONDSUB
	EXT COMPEX *bra_compex INIT(&(art_compex));
					/* current compex with brackets */
#   endif
    EXT char art_howmuch;		/* search just the subjects */
    EXT bool art_doread;		/* search read articles? */
#endif

void	artsrch_init ANSI((void));
#ifdef ARTSEARCH
    int		art_search ANSI((char *, int, int));
    bool	wanted ANSI((COMPEX *, ART_NUM, char_int));
			/* return TRUE if current article matches pattern */
#endif
!STUFFY!FUNK!
echo Extracting intrp.h
cat >intrp.h <<'!STUFFY!FUNK!'
/* $Id: intrp.h,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 *
 * $Log: intrp.h,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4.2.1  1991/12/01  18:05:42  sob
 * Patchlevel 2 changes
 *
 * Revision 4.4  1991/09/09  20:18:23  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT char *lib INIT(Nullch);		/* news library */
EXT char *rnlib INIT(Nullch);		/* private news program library */
EXT char *origdir INIT(Nullch);		/* cwd when rn invoked */
EXT char *homedir INIT(Nullch);		/* login directory */
EXT char *dotdir INIT(Nullch);		/* where . files go */
EXT char *logname INIT(Nullch);		/* login id */
EXT char *sitename INIT(Nullch);	/* host name */
EXT int perform_cnt;

#ifdef NEWSADMIN
    EXT char newsadmin[] INIT(NEWSADMIN);/* news administrator */
    EXT int newsuid INIT(0);
#endif

void    intrp_init ANSI((char *));
char	*filexp ANSI((char *));
char	*dointerp ANSI((char *,int,char *,char *));
void	interp ANSI((char *,int,char *));
void	refscpy ANSI((char *,int,char *));
char	*getrealname ANSI((long));
!STUFFY!FUNK!
echo Extracting makedir.SH
cat >makedir.SH <<'!STUFFY!FUNK!'
case $CONFIG in
    '') . ./config.sh ;;
esac
echo "Extracting makedir (with variable substitutions)"
$spitshell >makedir <<!GROK!THIS!
$startsh
# $Id: makedir.SH,v 4.4 1991/09/09 20:23:31 sob Exp sob $
# 
# $Log: makedir.SH,v $
# Revision 4.4  1991/09/09  20:23:31  sob
# release 4.4
#
#
# 
# This software is Copyright 1991 by Stan Barber. 
#
# 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. 

export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)

case \$# in
  0)
    $echo "makedir pathname filenameflag"
    exit 1
    ;;
esac

: guarantee one slash before 1st component
case \$1 in
  /*) ;;
  *)  set ./\$1 \$2 ;;
esac

: strip last component if it is to be a filename
case X\$2 in
  X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
  *)  set \$1 ;;
esac

: return reasonable status if nothing to be created
if $test -d "\$1" ; then
    exit 0
fi

list=''
while true ; do
    case \$1 in
    */*)
	list="\$1 \$list"
	set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
	;;
    *)
	break
	;;
    esac
done

set \$list

for dir do
    $mkdir \$dir >/dev/null 2>&1
done
!GROK!THIS!
$eunicefix makedir
chmod 755 makedir
!STUFFY!FUNK!
echo Extracting ng.h
cat >ng.h <<'!STUFFY!FUNK!'
/* $Id: ng.h,v 4.4 1991/09/09 20:23:31 sob Exp sob $
 *
 * $Log: ng.h,v $
 * Revision 4.4  1991/09/09  20:23:31  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT ART_NUM art INIT(0);	/* current or prospective article # */

EXT int checkcount INIT(0);	/* how many articles have we read */
			/*   in the current newsgroup since */
			/*   the last checkpoint? */
EXT int docheckwhen INIT(20);	/* how often to do checkpoint */

#ifdef MAILCALL
EXT int mailcount INIT(0);		/* check for mail when 0 mod 10 */
#endif
EXT char *mailcall INIT(nullstr);
#ifdef SERVER
EXT bool isfirstart INIT(TRUE);
#endif
EXT bool forcelast INIT(FALSE);		/* ought we show "End of newsgroup"? */
EXT bool forcegrow INIT(FALSE);		/* do we want to recalculate size */
				    /* of newsgroup, e.g. after posting? */

#define NG_ERROR -1
#define NG_NORM 0
#define NG_ASK 1
#define NG_MINUS 2

void    ng_init ANSI((void));
int	do_newsgroup ANSI((char *));
int	art_switch ANSI((void));
#ifdef MAILCALL
    void	setmail ANSI((void));
#endif
void	setdfltcmd ANSI((void));
!STUFFY!FUNK!
echo Extracting ngdata.h
cat >ngdata.h <<'!STUFFY!FUNK!'
/* $Id: ngdata.h,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 *
 * $Log: ngdata.h,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4  1991/09/09  20:23:31  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT FILE *actfp INIT(Nullfp);	/* the active file */
EXT bool writesoft INIT(FALSE);	/* rewrite the soft pointer file? */
EXT int softtries INIT(0), softmisses INIT(0);

#ifdef SERVER
    EXT char active_name[MAXFILENAME];
    EXT time_t lastactfetch INIT(0);
#define MINFETCHTIME (5 * 60)
#endif

#ifdef CACHEFIRST
    EXT ART_NUM *abs1st INIT(NULL);	/* 1st real article in newsgroup */
#else
# ifdef MININACT
    EXT ART_NUM abs1st INIT(0);
# endif
#endif

EXT char *moderated;
EXT long activeitems;			/* number of enties in active file */
void	ngdata_init ANSI((void));
ART_NUM	getngsize ANSI((NG_NUM));
ACT_POS findact ANSI((char *,char *,int,long));
ART_NUM	getabsfirst ANSI((NG_NUM,ART_NUM));
ART_NUM	getngmin ANSI((char *,ART_NUM));
!STUFFY!FUNK!
echo Extracting final.h
cat >final.h <<'!STUFFY!FUNK!'
/* $Id: final.h,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 * 
 * $Log: final.h,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4  1991/09/09  20:18:23  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

/* cleanup status for fast exits */

EXT bool panic INIT(FALSE);		/* we got hung up or something-- */
					/*  so leave tty alone */
EXT bool rc_changed INIT(FALSE);	/* need we rewrite .newsrc? */
EXT bool doing_ng INIT(FALSE);		/* do we need to reconstitute */
					/* current rc line? */

EXT char int_count INIT(0);		/* how many interrupts we've had */

EXT bool clear_on_stop INIT(FALSE);	/* set when handling the stop signal */
					/* would leave the screen a mess */

/* signal catching routines */

SIGRET	int_catcher ANSI((int));
SIGRET	sig_catcher ANSI((int));
#ifdef SIGTSTP
 SIGRET	stop_catcher ANSI((int));
#endif

void	final_init ANSI((void));
void	finalize ANSI((int));
!STUFFY!FUNK!
echo Extracting artstate.h
cat >artstate.h <<'!STUFFY!FUNK!'
/* $Id: artstate.h,v 4.4 1991/09/09 20:18:23 sob Exp sob $ 
 *
 * $Log: artstate.h,v $
 * Revision 4.4  1991/09/09  20:18:23  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT bool reread INIT(FALSE);		/* consider current art temporarily */
				    /* unread? */
EXT bool do_fseek INIT(FALSE);	/* should we back up in article file? */

EXT bool oldsubject INIT(FALSE);	/* not 1st art in subject thread */
EXT ART_LINE topline INIT(-1);		/* top line of current screen */
EXT bool do_hiding INIT(TRUE);		/* hide header lines with -h? */
#ifdef ROTATION
EXT bool rotate INIT(FALSE);		/* has rotation been requested? */
#endif
EXT char *prompt;			/* pointer to current prompt */

EXT char *firstline INIT(Nullch);			/* special first line? */
#ifdef CUSTOMLINES
EXT char *hideline INIT(Nullch);		/* custom line hiding? */
EXT char *pagestop INIT(Nullch);		/* custom page terminator? */
EXT COMPEX hide_compex;
EXT COMPEX page_compex;
#endif
!STUFFY!FUNK!
echo Extracting rn.h
cat >rn.h <<'!STUFFY!FUNK!'
/* $Id: rn.h,v 4.4 1991/09/09 20:27:37 sob Exp sob $
 *
 * $Log: rn.h,v $
 * Revision 4.4  1991/09/09  20:27:37  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT char *ngname INIT(Nullch);		/* name of current newsgroup */
EXT int ngnlen INIT(0);			/* current malloced size of ngname */
EXT char *ngdir INIT(Nullch);		/* same thing in directory name form */
EXT int ngdlen INIT(0);			/* current malloced size of ngdir */

EXT NG_NUM ng INIT(0);		/* current newsgroup index into rcline and toread */
EXT NG_NUM current_ng INIT(0);	/* stable current newsgroup so we can ditz with ng */
EXT NG_NUM starthere INIT(0);   /* set to the first newsgroup with unread news on startup */
EXT char *spool INIT(Nullch);		/* public news spool directory */

void	rn_init ANSI((void));
void	main ANSI((int,char **));
void	set_ngname ANSI((char *));
char	*getngdir ANSI((char *));
!STUFFY!FUNK!
echo Extracting respond.h
cat >respond.h <<'!STUFFY!FUNK!'
/* $Id: respond.h,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 *
 * $Log: respond.h,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4.2.1  1991/12/01  18:05:42  sob
 * Patchlevel 2 changes
 *
 * Revision 4.4  1991/09/09  20:27:37  sob
 * release 4.4
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT char *savedest INIT(Nullch);	/* value of %b */
EXT char *extractdest INIT(Nullch);	/* value of %E */
EXT char *extractprog INIT(Nullch);	/* value of %e */
EXT ART_POS savefrom INIT(0);		/* value of %B */
EXT char *headname INIT(Nullch);

#define SAVE_ABORT 0
#define SAVE_DONE 1

void	respond_init ANSI((void));
int	save_article ANSI((void));
int	cancel_article ANSI((void));
int	supersede_article ANSI((void));
void	reply ANSI((void));
void	followup ANSI((void));
void	invoke ANSI((char *,char *));
!STUFFY!FUNK!
echo Extracting norm.saver.SH
cat >norm.saver.SH <<'!STUFFY!FUNK!'
case $CONFIG in
    '') . ./config.sh ;;
esac
echo "Extracting norm.saver (with variable substitutions)"
$spitshell >norm.saver <<!GROK!THIS!
$startsh
# $Id: norm.saver.SH,v 4.4 1991/09/09 20:23:31 sob Exp sob $
# 
# $Log: norm.saver.SH,v $
# Revision 4.4  1991/09/09  20:23:31  sob
# release 4.4
#
# 
# This software is Copyright 1991 by Stan Barber. 
#
# 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 of 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. 
# 
#	Arguments:
#	1 Full name of article (%A)
#	2 Public news spool directory (%P)
#	3 Directory of current newsgroup (%c)
#	4 Article number (%a)
#	5 Where in article to start (%B)
#	6 Newsgroup name (%C)
#	7 Save destination (%b)
#
export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)

( case "\$5" in
  0) $echo "Article \$4 of \$6:" ;;
  esac
  $tail +\$5c \$1
  $echo ""
  $echo "" ) >> \$7
!GROK!THIS!
$eunicefix norm.saver
chmod 755 norm.saver
!STUFFY!FUNK!
echo Extracting last.h
cat >last.h <<'!STUFFY!FUNK!'
/* $Id: last.h,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 *
 * $Log: last.h,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4  1991/09/09  20:23:31  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT char *lastngname INIT(Nullch);	/* last newsgroup read, from .rnlast file */
EXT long lasttime INIT(0);	/* time last rn was started up */
EXT long lastactsiz INIT(0);	/* size of active file when rn last started up */
EXT long lastnewtime INIT(0);	/* time last new group was found */
EXT long lastnewsize INIT(0);	/* size of active.times file when rn last started up */

void	last_init ANSI((char *));
void    writelast ANSI((void));
!STUFFY!FUNK!
echo Extracting ngsrch.h
cat >ngsrch.h <<'!STUFFY!FUNK!'
/* $Id: ngsrch.h,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 *
 * $Log: ngsrch.h,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4  1991/09/09  20:23:31  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#ifdef NGSEARCH
#define NGS_ABORT 0
#define NGS_FOUND 1
#define NGS_INTR 2
#define NGS_NOTFOUND 3
#define NGS_ERROR 4

EXT bool ng_doread INIT(FALSE);		/* search read newsgroups? */
#endif

void	ngsrch_init ANSI((void));
#ifdef NGSEARCH 
    int		ng_search ANSI((char *,int));
    bool	ng_wanted ANSI((void));
#endif
#ifdef NGSORONLY
    char	*ng_comp ANSI((COMPEX *,char *,bool_int,bool_int));
#endif
!STUFFY!FUNK!
echo Extracting kfile.h
cat >kfile.h <<'!STUFFY!FUNK!'
/* $Id: kfile.h,v 4.4 1991/09/09 20:18:23 sob Exp sob $
 *
 * $Log: kfile.h,v $
 * Revision 4.4  1991/09/09  20:18:23  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

#define KF_GLOBAL 0
#define KF_LOCAL 1

#ifdef KILLFILES
EXT FILE *globkfp INIT(Nullfp);		/* global article killer file */
EXT FILE *localkfp INIT(Nullfp);	/* local (for this newsgroup) */
					/*  article killer file */
#endif

void	kfile_init ANSI((void));
int	do_kfile ANSI((FILE *,int));
void	kill_unwanted ANSI((ART_NUM,char *,int));
int	edit_kfile ANSI((void));
void	open_kfile ANSI((int));
void    kf_append ANSI((char *));
void	setthru ANSI((ART_NUM));
!STUFFY!FUNK!
echo Extracting rcln.h
cat >rcln.h <<'!STUFFY!FUNK!'
/* $Id: rcln.h,v 4.4.3.1 1992/02/01 03:09:32 sob PATCH_3 sob $
 *
 * $Log: rcln.h,v $
 * Revision 4.4.3.1  1992/02/01  03:09:32  sob
 * Release 4.4 Patchlevel 3
 *
 * Revision 4.4  1991/09/09  20:27:37  sob
 * release 4.4
 *
 *
 * 
 */
/* This software is Copyright 1991 by Stan Barber. 
 *
 * 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 of 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. 
 */

EXT ART_NUM *ngmax INIT(NULL);

void    rcln_init ANSI((void));
#ifdef CATCHUP
    void	catch_up ANSI((NG_NUM));
#endif
int	addartnum ANSI((ART_NUM,char *));
#ifdef MCHASE
    void	subartnum ANSI((ART_NUM,char *));
#endif
void	prange ANSI((char *,ART_NUM,ART_NUM));
void	set_toread ANSI((NG_NUM));
void	checkexpired ANSI((NG_NUM,ART_NUM));
!STUFFY!FUNK!
echo Extracting server.h.SH
cat >server.h.SH <<'!STUFFY!FUNK!'
: create server.h file
case $CONFIG in
    '') . ./config.sh ;;
esac
if $test $isrrn = define 
then
$echo "Extracting server.h (with variable substitutions)"
$cat >server.h <<!GROK!THIS!
/*
 * $Id$
 * 
 * $Log$
 * 
 * 
 * This software is Copyright 1991 by Stan Barber. 
 * 
 * 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 of 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. 
 */
#ifdef SERVER

extern  char    *getserverbyfile ANSI((char *));
extern  int     server_init ANSI((char *));
extern  void    put_server ANSI((char *));
extern  int     get_server ANSI((char *,int));
extern  void    close_server ANSI((void));

#include "$NNTPSRC/common/nntp.h"
EXT     char ser_line[NNTP_STRLEN];
#endif
!GROK!THIS!
else
	rm -f server.h
fi
!STUFFY!FUNK!
echo Extracting kittrailer
cat >kittrailer <<'!STUFFY!FUNK!'
#! /bin/sh
# $Id$
#
# $Log$
# 
# This software is Copyright 1991 by Stan Barber. 
#
# 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 of 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. 
rangelist=`range 1 $3`
cat >>$1 <<EOT
echo ""
echo "End of kit $2 (of $3)"
cat /dev/null >kit${2}isdone
config=true
for iskit in $rangelist; do
    if test -f kit\${iskit}isdone; then
	echo "You have run kit \${iskit}."
    else
	echo "You still need to run kit \${iskit}."
	config=false
    fi
done
case \$config in
    true)
	echo "You have run all your kits.  Please read README and then type Configure."
	chmod 755 Configure
	;;
esac
: I do not append .signature, but someone might mail this.
exit
EOT
!STUFFY!FUNK!
echo Extracting kitleader
cat >kitleader <<'!STUFFY!FUNK!'
#! /bin/sh
# $Id: kitleader,v 4.4 1991/09/09 20:18:23 sob Exp sob $
#
# $Log: kitleader,v $
# Revision 4.4  1991/09/09  20:18:23  sob
# release 4.4
#
# 
# This software is Copyright 1991 by Stan Barber. 
#
# 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 of 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. 
cat >$1 <<EOT
#! /bin/sh
# Make a new directory for the rn sources, cd to it, and run kits 1 thru $3 
# through sh.  When all $3 kits have been run, read README.

echo "This is rn kit $2 (of $3).  If kit $2 is complete, the line"
echo '"'"End of kit $2 (of $3)"'" will echo at the end.'
echo ""
export PATH || (echo "You didn't use sh, you clunch." ; kill \$\$)
EOT
!STUFFY!FUNK!
echo ""
echo "End of kit 10 (of 11)"
cat /dev/null >kit10isdone
config=true
for iskit in 1 2 3 4 5 6 7 8 9 10 11 ; do
    if test -f kit${iskit}isdone; then
	echo "You have run kit ${iskit}."
    else
	echo "You still need to run kit ${iskit}."
	config=false
    fi
done
case $config in
    true)
	echo "You have run all your kits.  Please read README and then type Configure."
	chmod 755 Configure
	;;
esac
: I do not append .signature, but someone might mail this.
exit
