[comp.sources.misc] v09i070: newsclip 1.1, part 1 of 15

brad@looking.ON.CA (Brad Templeton) (12/20/89)

Posting-number: Volume 9, Issue 70
Submitted-by: brad@looking.ON.CA (Brad Templeton)
Archive-name: newsclip/part01

[THIS IS A SHAREWARE PACKAGE!  ++bsa]

[This is Brad Templeton's "newsclip" Usenet news selection compiler for
ClariNet.  Brad has decided to release it as a shareware product.  Given
the usefulness of this package, I certainly hope you will send him the
money he requests for this if you decide to use it; I've seen far less useful
stuff at much higher prices even in the shareware market.  ++bsa]

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 15)."
# Contents:  MANIFEST Makefile READ.ME body.h cdate.h common.h comp/
#   comp/Makefile comp/art.c comp/cfuncs.h comp/common.h comp/nc.h
#   comp/node.c comp/node.h comp/tree.h comp/y.tab.h db.h debug.h
#   distlist distr doc/ doc/mknewsrc.1 flist.c funcs.h guide mkdat.c
#   nctest.nc nl.h patch/ patch/pipemode.h pipemode.h regmagic.h rei.h
#   rxp.h samples/ thevars.h
# Wrapped by allbery@uunet on Tue Dec 19 20:09:49 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(2855 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X About                      2	
X Licence                    2	
X MANIFEST                   1	
X Makefile                   1	
X READ.ME                    1	
X alloc.c                    3	
X article.c                  4	
X body.h                     1	
X cdate.h                    1	
X common.h                   1	
X comp/                      1	
X comp/Makefile              1	
X comp/art.c                 1	
X comp/cfuncs.h              1	
X comp/check.c               7	
X comp/clib.c                2	
X comp/common.h              1	
X comp/hlist.c               3	
X comp/lex.c                 4	
X comp/nc.h                  1	
X comp/ncc.c                 3	
X comp/nl.y                  6	
X comp/node.c                1	
X comp/node.h                1	
X comp/node.m4               2	
X comp/out.c                 5	
X comp/predef.c              4	
X comp/symtab.c              7	
X comp/tree.c                2	
X comp/tree.h                1	
X comp/ucode.h               2	
X comp/wrdata.c              2	
X comp/y.tab.h               1	
X db.c                       6	
X db.h                       1	
X debug.h                    1	
X distlist                   1	
X distr                      1	
X doc/                       1	
X doc/append.mm.1           11	
X doc/append.mm.2           12	
X doc/filter.man             8	
X doc/man.mm.1              14	
X doc/man.mm.2              15	
X doc/man.mm.3              13	
X doc/mknewsrc.1             1	
X doc/ncc.1                  3	
X doc/nclip.1                5	
X flist.c                    1	
X funcs.h                    1	
X getdate.y                  8	
X group.c                    4	
X guide                      1	
X has.c                      7	
X header.c                   5	
X main.c                     6	
X mkdat.c                    1	
X mknewsrc.c                 6	
X nctest.nc                  1	
X nl.h                       1	
X nllib.c                    2	
X nrc.c                      8	
X patch/                     1	
X patch/filter.man           9	
X patch/filtpipe.c           6	
X patch/pipemode.h           1	
X patch/read.me              3	
X patch/rnpatch              3	
X pipe.c                     7	
X pipemode.h                 1	
X regexp.c                  10	
X regmagic.h                 1	
X rei.h                      1	
X rxp.h                      1	
X samples/                   1	
X samples/feed.nc            5	
X samples/myprog.nc          3	
X samples/sample.nc          3	
X scanbody.c                 9	
X sysdefs.bsd                2	
X sysdefs.h                  2	
X sysdefs.sysv               2	
X sysdefs.v7                 2	
X sysdefs.x286               3	
X thevars.h                  1	
X ucode.h                    2	
X userdb.c                   5	
X userlib.c                  4	
X whoami.c                   4	
END_OF_FILE
if test 2855 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(1464 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
XOBJS = getdate.o header.o nllib.o main.o article.o nrc.o flist.o \
X	whoami.o db.o userlib.o userdb.o group.o alloc.o \
X	has.o scanbody.o regexp.o pipe.o
X
XCOMDIR=/usr/local
XLIBDIR=/usr/lib/news
XMANDIR=/usr/man/man1
XCLIPDIR=$(LIBDIR)/newsclip
X
X#The normal definition compile and load flags
X
XCFLAGS=
XLDFLAGS=
X
X#Use the following CFLAGS and LDFLAGS for Xenix/286
X#CFLAGS=-g -Ml2
X#LDFLAGS=-F 2000
X
Xall: cliplib.a comp/ncc mknewsrc
X
Xnctest: cliplib.a nctest.o
X	cc $(CFLAGS) $(LDFLAGS) nctest.o cliplib.a -o nctest
X
X
Xmknewsrc: mknewsrc.o alloc.o db.o regexp.o whoami.o
X	cc $(CFLAGS) mknewsrc.o alloc.o db.o regexp.o whoami.o -o mknewsrc
X
Xcomp/ncc:
X	cd comp ; make ncc "CFLAGS=-I.. $(CFLAGS)" "LDFLAGS=$(LDFLAGS)"
X
Xcliplib.a: $(OBJS)
X	rm -f cliplib.a
X	ar cq cliplib.a $(OBJS)
X	ranlib cliplib.a
X
Xnctest.o: nctest.c
X	cc $(CFLAGS) -I. -c nctest.c
X
Xnctest.c: nctest.nc
X	comp/ncc -l nctest.nc
X
Xgetdate.o:  getdate.y
X	@echo "expect 8 shift/reduce conflicts"
X	yacc getdate.y
X	mv y.tab.c getdate.c
X	$(CC) $(CFLAGS) -c getdate.c
X	-rm -f getdate.c
X
Xmain.o:	cdate.h
X
Xcdate.h: mkdat
X	mkdat >cdate.h
X
Xmkdat: mkdat.c
X	cc mkdat.c -o mkdat
X
Xinstall: all
X	-mv comp/ncc $(COMDIR)
X	-mv mknewsrc $(COMDIR)
X	-cp doc/*.1 $(MANDIR)
X	-mkdir $(CLIPDIR)
X	-cp ucode.h samples/* $(CLIPDIR)
X	-mv cliplib.a $(CLIPDIR)
X	-if test ! -r $(LIBDIR)/distlist ; then echo "Distribution List not created.  Creating"; cp distlist $(LIBDIR)/distlist;fi
X
Xclean:
X	rm -f *.o comp/*.o y.tab.h getdate.c comp/parser.c
END_OF_FILE
if test 1464 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'READ.ME' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'READ.ME'\"
else
echo shar: Extracting \"'READ.ME'\" \(2626 characters\)
sed "s/^X//" >'READ.ME' <<'END_OF_FILE'
X
XNewsClip(TM) News filter compiler and library V1.01
XCopyright 1989 Looking Glass Software Limited, All Rights Reserved.
XSee file 'Licence' for details.
X
XThe NewsClip system is a programming language that lets you control
Xexactly what USENET news you will see and not see.  You describe
Xarticles in as detailed a fashion as desired, and the library helps you
Xuse these description programs to stop you from reading undesired articles.
X
XFull installation instructions are contained in an appendix of the manual.
XWe advise reading those before installing.
X
XMail comments, bug reports and support questions to newsclip@looking.on.ca.
XDo NOT mail directly to the program authors' private mailboxes or your note
Xmay be thrown away.
X
XBinary users on a fairly standard news system should be able to begin
Xwith ncc and resulting programs immediately, so long as 'cliplib.a' and
X'ucode.h' reside in the current directory when compiling, and a 'distlist'
Xfile has been placed in the user's home (or DOTDIR) directory or the
X/usr/lib/news directory.  (Use the standard 'distlist' as a starting point.)
X
XSource code users should configure the system by moving one of the files
Xof the 'sysdefs.<os>' type to 'sysdefs.h', and then examining and editing
Xthat file as needed for the local system.  In particular, define ANSI_PROTO
Xif your C compiler takes ANSI C function prototypes, and undefine it if it
Xdoesn't.  Then :
X		make all
Xand install 'comp/ncc' in your local commands directory.  Make a 'newsclip' 
Xdirectory, or use the news LIB directory  ('/usr/lib/news'), and place 
X'cliplib.a' and 'ucode.h' in this directory,  along with sample programs 
X*.nc.   
X
XFinally make a 'distlist' file in the news LIB directory as described in
Xthe manual.  Use the 'distlist' provided as a starting point.
X
XSysdef files:
X	sysdefs.x286	- xenix/286
X	sysdefs.4bsd	- BSD systems (check GETHOSTNAME #define)
X	sysdefs.sysv	- System III or System V based Unix (Includes Xenix/386)
X	sysdefs.v7	- V7 or very early BSD.  You must have a "whoami.h"
X			  file or an /etc/systemid file with sys name.
X
XSee the file 'guide' for other source code information:
X
XAll files in this distribution, unless explicitly otherwise noted, are
Xcopyright 1989 by Looking Glass Software Limited.  All Rights Reserved.
XSee licence terms in the manual for more details.
X
XNote on links:
X	If you received a 'shar' distribution of this package, some links
X	may have been removed, resulting in multiple copies of the same file.
X	If this is so, do the following (in your main NC source directory):
X
X	ln common.h ucode.h comp
X	ln filtpipe.c pipemode.h patch
X	ln doc/filter.man patch
END_OF_FILE
if test 2626 -ne `wc -c <'READ.ME'`; then
    echo shar: \"'READ.ME'\" unpacked with wrong size!
fi
# end of 'READ.ME'
fi
if test -f 'body.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'body.h'\"
else
echo shar: Extracting \"'body.h'\" \(1626 characters\)
sed "s/^X//" >'body.h' <<'END_OF_FILE'
X/*
X * body.h
X *
X * Definitions and declarations used in the handling of article bodies.
X *
X */
X
X#define LT_NONE		0	/* Identifiers: types of text */
X#define LT_SIGNATURE	1
X#define LT_INCLUDED	2
X#define LT_NEWTEXT	4
X#define LT_TEXT		6
X#define LT_BODY		7
X
X#define AS_ARR_SIZE	8	/* Article statistic array size. */
X#define ID_LINES	0	/* Indices into the statistics array. */
X#define ID_BYTES	1
X
Xextern long ArticleStats[2][AS_ARR_SIZE];
X
X#define H_TRUE		(1)	/* Indicates result of "has op" is TRUE */
X#define H_FALSE		(0)	/* Indicates result of "has op" is FALSE */
X
X#define AR_LOW_IDX	0	/* Option Base declaration for user arrays */
X
X#define BLOCK_SIZE	2048	/* Read 2K of file at a time. */
X
X/* u_list contains a list of pointers to a variable number of
X * units, and a pointer to an additional u_list for further units.
X * The size member counts only those units pointed to locally.  */
X
Xtypedef struct _ul {
X	short size;		/* Number of entries in this list. */
X	struct _ul *next;	/* Ptr the next block. */
X	char *u_txt[1];		/* Actual array of pointers to units. */
X	} u_list;
X
X#define ULB_SIZE	128	/* Buffer this many lines per u_list. */
X
X/* One area_type is constructed for each distinct area found in
X * the article body.  Each area is linked sequentially to the
X * next one.  Information about the type of area is maintained.  */
X
Xtypedef struct _at {
X	char txt_typ;		/* Type of text represented. */
X	unsigned int size;	/* Number of bytes in text area. */
X	u_list *list;		/* Contents of the text area. */
X	char *para;		/* Contents of text area as a paragraph. */
X	struct _at *next;	/* Ptr to the next area. */
X	} area_type;
END_OF_FILE
if test 1626 -ne `wc -c <'body.h'`; then
    echo shar: \"'body.h'\" unpacked with wrong size!
fi
# end of 'body.h'
fi
if test -f 'cdate.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cdate.h'\"
else
echo shar: Extracting \"'cdate.h'\" \(10 characters\)
sed "s/^X//" >'cdate.h' <<'END_OF_FILE'
X625433570
END_OF_FILE
if test 10 -ne `wc -c <'cdate.h'`; then
    echo shar: \"'cdate.h'\" unpacked with wrong size!
fi
# end of 'cdate.h'
fi
if test -f 'common.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'common.h'\"
else
echo shar: Extracting \"'common.h'\" \(2594 characters\)
sed "s/^X//" >'common.h' <<'END_OF_FILE'
X/* The declarations common to the compiler and runtime modules */
X/* Copyright 1989 Looking Glass Software Limited.  All Rights Reserved. */
X
X
X#include "sysdefs.h"
X#include <stdio.h>
X#include <string.h>
X#include <ctype.h>
X#include <sys/types.h>
X
X#define DEBUG 1
X#define debug 1
X#define debstr stderr
X
X#include "debug.h"
X
X#ifdef INTS_32
Xtypedef int int32;
Xtypedef short int16;
X#else
Xtypedef long int32;
Xtypedef int int16;
X#endif
X
Xtypedef long datehold;
Xtypedef int newsgroup;
X
X/* The types for data values in NL programs */
X
X#define T_NONE 0
X#define T_INTEGER 1
X#define T_DATE 2
X#define T_NEWSGROUP 3
X#define T_NUMERIC T_NEWSGROUP	/* Less or equal this are equiv numeric types */
X#define T_STRING 4
X#define T_USERNAME 5
X#define T_DATABASE 6
X
X/* internal types */
X#define T_TEXT 7		/* article body strings */
X#define T_GENARRAY	10	/* any kind of array */
X#define T_GENPTR	11	/* any kind of pointer type */
X
X#define T_ARRAY 64
X#define T_DUALCASE 128
X#define T_BASETYPE 63
X
X#define arrayof(x) (T_ARRAY|x)
X
Xtypedef unsigned char byte;
Xtypedef unsigned char bool;
Xtypedef byte dtype;		/* data type */
X
X
X#define FALSE 0
X#define TRUE 1
X
X/* The result of parsing a mail From: address */
X
Xtypedef struct user_name {
X	char *emailname;	/* the mail name, ie: user@site.foo */
X	char *fullname;		/* the full name or comment */
X	} username;
X
X
Xtypedef union d_union {
X	int	uinteger;	/* integer or newsgroup types */
X	long	udate;		/* date or long int types */
X	char	*ustring;	/* string types */
X	char	*regexp;	/* compiled regular expressions */
X	username *uusername;	/* a user name struct */
X	} datau;
X
X/* The struct for a multi-valued array.  The array is declared with only
X   one element, but in fact this structure can be allocated with enough
X   space for any number of elements, and C lets us access them without
X   checks. */
X
Xtypedef struct h_array {
X	int arsize;		/* number of elements in the array */
X	byte artype;		/* type of the elements in the array */
X	datau vals[1];		/* actually an extensible array, as allocated */
X	} array;
X
X
X/* Struct defining header items to process */
Xstruct hitem_list {
X	char *hname;		/* name of header */
X	int dtype;		/* data type of header data */
X	char *delims;		/* delimiters to use if an array */
X	datau *var;		/* address of variable to put data into */
X	};
X
X/* useful macros */
X
X#define max(x,y)	((x)>(y) ? (x):(y))
X#define min(x,y)	((x)<(y) ? (x):(y))
X
X/* case */
X
X/* lower case if we know it's a letter. (ASCII only) */
X#define lowerlet(x) (x | 0x20)
X
X/* lower case after testing. (ASCII only) */
X#define lowcase(x) (((x) >= 'A' && (x) <= 'Z') ? (x) | 0x20 : (x))
END_OF_FILE
if test 2594 -ne `wc -c <'common.h'`; then
    echo shar: \"'common.h'\" unpacked with wrong size!
fi
# end of 'common.h'
fi
if test ! -d 'comp/' ; then
    echo shar: Creating directory \"'comp/'\"
    mkdir 'comp/'
fi
if test -f 'comp/Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'comp/Makefile'\"
else
echo shar: Extracting \"'comp/Makefile'\" \(674 characters\)
sed "s/^X//" >'comp/Makefile' <<'END_OF_FILE'
X
XOBJS=parser.o tree.o symtab.o hlist.o lex.o predef.o clib.o node.o \
X	ncc.o check.o out.o wrdata.o
X
X# C flags local to this make file
X
X# Don't bother defining CFLAGS if you expect to inherit it from the parent
X# make all above.  Otherwise define it as follows:
X
X# For general systems
X#CFLAGS=-I..
X
X# For Xenix/286
X
X#CFLAGS=-g -I.. -Ml2
X
Xncc: $(OBJS)
X	cc $(CFLAGS) $(OBJS) ../db.o -o ncc
X
Xparser.c: nl.y
X	yacc -d nl.y
X	mv y.tab.c parser.c
X
Xparser.o: parser.c node.h
X	cc $(CFLAGS) -c parser.c
X
X# This csplit relies on links of nsplit00 and nsplit01 to the files
X# node.h and node.c
Xnode.h : node.m4
X	m4 node.m4  >/tmp/nodeout
X	csplit -f nsplit /tmp/nodeout "/BEGIN_DEFINE/"
X
END_OF_FILE
if test 674 -ne `wc -c <'comp/Makefile'`; then
    echo shar: \"'comp/Makefile'\" unpacked with wrong size!
fi
# end of 'comp/Makefile'
fi
if test -f 'comp/art.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'comp/art.c'\"
else
echo shar: Extracting \"'comp/art.c'\" \(552 characters\)
sed "s/^X//" >'comp/art.c' <<'END_OF_FILE'
X#include <ucode.h>
Xarray * Ufoo;
Xarray * Ubar;
Xchar * Ubaz;
Xnewsgroup Un;
Xuser_initialize() {}
Xuser_startng() {}
Xuser_finishng() {}
X
Xuser_article()
X	{
X	
X	Ufoo = fresh_array(5,65);
X	Ufoo = parse_array(Ubaz,"! ",65);
X	Ubar = parse_array(ngn(Un)," ",68);
X}
Xuser_post_article() {}
Xuser_terminate() {}
Xbool needs_stat = 0;
Xbool wants_dist = 0;
Xstruct hitem_list header_items[] = {
X{ "newsgroups", 67, ", ", (datau *)&newsgroups },
X{ 0, 0, 0, 0 }
X};
Xint num_headers = 1;
Xchar *user_groupnames[] = {
X0 };
Xchar *user_patterns[] = {
X0 };
Xint pattern_count = 0;
END_OF_FILE
if test 552 -ne `wc -c <'comp/art.c'`; then
    echo shar: \"'comp/art.c'\" unpacked with wrong size!
fi
# end of 'comp/art.c'
fi
if test -f 'comp/cfuncs.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'comp/cfuncs.h'\"
else
echo shar: Extracting \"'comp/cfuncs.h'\" \(1154 characters\)
sed "s/^X//" >'comp/cfuncs.h' <<'END_OF_FILE'
X/* Copyright 1989 Looking Glass Software Limited.  All Rights Reserved. */
X
Xextern	nodep extern_var AC(( char *, dtype ));
Xextern	symptr extern_decl AC((char *, int, dtype, struct typelist * ));
Xextern	nodep extern_func AC((char *, dtype, listp, bool ));
Xextern	symptr declare_local AC((char *, int, dtype ));
Xextern	nodep declare_var AC((char *, dtype ));
Xextern	nodep gen_declare AC(( char * ));
Xextern	nodep declare_arg AC(( char *, dtype ));
Xextern	nodep declare_lab AC(( char * ));
Xextern	nodep goto_lookup AC(( char * ));
Xextern	nodep symlookup AC(( char *, dtype, dtype ));
Xextern	nodep declid AC(( symptr ));
X
Xextern	nodep tree AC((byte,));
Xextern	listp freshlist AC((nodep));
Xextern	listp llist AC(( nodep, nodep ));
X
X/* typechecking functions */
X
Xextern dtype procint AC(( nodep, dtype, dtype ));
Xextern bool insist_variable AC(( nodep ));
Xextern bool is_variable AC((nodep));
Xextern dtype check AC(( nodep ));
Xextern bool assign_check AC(( dtype, nodep, dtype ));
Xextern make_string AC(( nodep, dtype ));
X
Xextern char *allocstring AC(( char * ));
Xextern char *checkalloc AC(( unsigned int ));
X
Xextern struct typelist *buildargs AC(( listp ));
END_OF_FILE
if test 1154 -ne `wc -c <'comp/cfuncs.h'`; then
    echo shar: \"'comp/cfuncs.h'\" unpacked with wrong size!
fi
# end of 'comp/cfuncs.h'
fi
if test -f 'comp/common.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'comp/common.h'\"
else
echo shar: Extracting \"'comp/common.h'\" \(2594 characters\)
sed "s/^X//" >'comp/common.h' <<'END_OF_FILE'
X/* The declarations common to the compiler and runtime modules */
X/* Copyright 1989 Looking Glass Software Limited.  All Rights Reserved. */
X
X
X#include "sysdefs.h"
X#include <stdio.h>
X#include <string.h>
X#include <ctype.h>
X#include <sys/types.h>
X
X#define DEBUG 1
X#define debug 1
X#define debstr stderr
X
X#include "debug.h"
X
X#ifdef INTS_32
Xtypedef int int32;
Xtypedef short int16;
X#else
Xtypedef long int32;
Xtypedef int int16;
X#endif
X
Xtypedef long datehold;
Xtypedef int newsgroup;
X
X/* The types for data values in NL programs */
X
X#define T_NONE 0
X#define T_INTEGER 1
X#define T_DATE 2
X#define T_NEWSGROUP 3
X#define T_NUMERIC T_NEWSGROUP	/* Less or equal this are equiv numeric types */
X#define T_STRING 4
X#define T_USERNAME 5
X#define T_DATABASE 6
X
X/* internal types */
X#define T_TEXT 7		/* article body strings */
X#define T_GENARRAY	10	/* any kind of array */
X#define T_GENPTR	11	/* any kind of pointer type */
X
X#define T_ARRAY 64
X#define T_DUALCASE 128
X#define T_BASETYPE 63
X
X#define arrayof(x) (T_ARRAY|x)
X
Xtypedef unsigned char byte;
Xtypedef unsigned char bool;
Xtypedef byte dtype;		/* data type */
X
X
X#define FALSE 0
X#define TRUE 1
X
X/* The result of parsing a mail From: address */
X
Xtypedef struct user_name {
X	char *emailname;	/* the mail name, ie: user@site.foo */
X	char *fullname;		/* the full name or comment */
X	} username;
X
X
Xtypedef union d_union {
X	int	uinteger;	/* integer or newsgroup types */
X	long	udate;		/* date or long int types */
X	char	*ustring;	/* string types */
X	char	*regexp;	/* compiled regular expressions */
X	username *uusername;	/* a user name struct */
X	} datau;
X
X/* The struct for a multi-valued array.  The array is declared with only
X   one element, but in fact this structure can be allocated with enough
X   space for any number of elements, and C lets us access them without
X   checks. */
X
Xtypedef struct h_array {
X	int arsize;		/* number of elements in the array */
X	byte artype;		/* type of the elements in the array */
X	datau vals[1];		/* actually an extensible array, as allocated */
X	} array;
X
X
X/* Struct defining header items to process */
Xstruct hitem_list {
X	char *hname;		/* name of header */
X	int dtype;		/* data type of header data */
X	char *delims;		/* delimiters to use if an array */
X	datau *var;		/* address of variable to put data into */
X	};
X
X/* useful macros */
X
X#define max(x,y)	((x)>(y) ? (x):(y))
X#define min(x,y)	((x)<(y) ? (x):(y))
X
X/* case */
X
X/* lower case if we know it's a letter. (ASCII only) */
X#define lowerlet(x) (x | 0x20)
X
X/* lower case after testing. (ASCII only) */
X#define lowcase(x) (((x) >= 'A' && (x) <= 'Z') ? (x) | 0x20 : (x))
END_OF_FILE
if test 2594 -ne `wc -c <'comp/common.h'`; then
    echo shar: \"'comp/common.h'\" unpacked with wrong size!
fi
# end of 'comp/common.h'
fi
if test -f 'comp/nc.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'comp/nc.h'\"
else
echo shar: Extracting \"'comp/nc.h'\" \(2341 characters\)
sed "s/^X//" >'comp/nc.h' <<'END_OF_FILE'
X
X/* Copyright 1989 Looking Glass Software Limited.  All Rights Reserved. */
X
X
X#include "common.h"
X
X
X#include "tree.h"
X#include "node.h"
X#include "db.h"
X/* The kinds of symbols */
X
X#define ST_VAR		1
X#define ST_LABEL	2
X#define ST_FUNC		3
X#define ST_PROC		4
X#define ST_LABREF	5		/* an undeclared label ref */
X/*#define ST_CONST	6		UNUSED */
X#define ST_TEXT		7		/* text symbol */
X
Xtypedef struct sym_entry {
X	char *name;
X	struct sym_entry *next;
X	byte hflags;
X	byte sflags;		/* our symbol flags */
X	byte decl_type;		/* what kind of symbol this is */
X	dtype type;		/* user type */
X	struct typelist * argtypes;	/* list of argument types */
X	} *symptr;
X
X/* Symbol Flags */
X
X#define NF_DECLARED 1		/* this symbol has been declared */
X#define NF_PREFIX 2		/* this is a user global and needs a prefix */
X
X/* special struct for outside symtab array */
X
Xstruct outsym {
X	char *name;		/* name of symbol */
X	byte odecl_type;	/* outside sym decl type */
X	dtype otype;		/* actual return type etc. */
X	byte flags;		/* special flags */
X	struct typelist *atlist;	/* argument type list */
X	};
X
X
X/* struct for newsgroup names and patterns and other things that get
X   mapped into numbers */
X
Xtypedef struct ng_name {
X	char *name;
X	struct ng_name *next;
X	byte hflags;
X	int ngnum;			/* the newsgroup number */
X	struct ng_name *ng_next;	/* chain of newsgroups in order */
X	} numstring;
X
Xstruct stringmap {
X	dbptr	dbase;			/* the database */
X	int	counter;		/* counter of elements */
X	numstring *first;		/* first in chain */
X	numstring *current;		/* current in chain */
X	};
X
X
X#include "cfuncs.h"
X
X/* symbol flags */
X
X#define SPC_HEADER	1		/* make a header reference */
X#define SPC_STAT	2		/* turn on needs stat */
X#define SPC_FROM	3		/* insist that from header be refed */
X#define SPC_NEWSGROUPS	4		/* insist that newsgroups be refed */
X#define SPC_REF		5		/* needs the references line */
X#define SPC_DIST	6		/* wants distribution level */
X
X#define OSF_SPECIAL_MASK 7
X#define SF_FORWARD 8			/* This is a forward reference */
X#define SF_LOCAL 16			/* this is a local symbol */
X#define OSF_REFERENCED 32		/* this symbols has been referenced
X					   already */
X#define OSF_PREDEF 64			/* this symbol does not have to be
X					   declared externally */
X#define OSF_CONST 128			/* the symbol is a constant */
X
X/* error names */
X#define SYNTAX_ERROR 2
X#define TYPE_ERROR 1
X
END_OF_FILE
if test 2341 -ne `wc -c <'comp/nc.h'`; then
    echo shar: \"'comp/nc.h'\" unpacked with wrong size!
fi
# end of 'comp/nc.h'
fi
if test -f 'comp/node.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'comp/node.c'\"
else
echo shar: Extracting \"'comp/node.c'\" \(2344 characters\)
sed "s/^X//" >'comp/node.c' <<'END_OF_FILE'
X/*
X *	The node types for the first byte in any node
X */
X
X/* macro arguments
X * $1 - name of node
X * $2 - print code
X * $3 - flags for the node
X * $4 - number of tree-type children for the node
X * $5 - number of total children for the node
X */
X
X
X#include "nc.h"
Xstruct node_info node_table[] = {
X {"", 0, 0, 0 },
X {"", 0, 0, 0 },
X {"extern !0d;", 0, 1, 1 },
X {"extern !0d();", 0, 2, 2 },
X {"!0d;", 0, 1, 1 },
X {"!0i", 0, 0, 1 },
X {"!0l\n!1l", 0, 2, 2 },
X {"!0t : !1t", 0, 2, 2 },
X {"case !0t :\n!1t", 0, 2, 2 },
X {"default:\n!0t", 0, 1, 1 },
X {"{\n!0l\n}", 0, 1, 1 },
X {"!0t;", 0, 1, 1 },
X {"score += (!0t);", 0, 1, 1 },
X {"", 0, 2, 2 },
X {"!0t = !1t", 0, 2, 2 },
X {"if( !0t )!>\n!1t!<", 0, 2, 2 },
X {"if( !0t )!>\n!1t!<\nelse!>\n!2t!<", TF_ONEINT, 3, 3 },
X {"switch( !0t ) !>\n!1t!<", TF_ONEINT, 2, 2 },
X {"while( !0t )!>\n!1t!<", TF_ONEINT, 2, 2 },
X {"for( !0t; !1t; !2t ) !>\n!3t!<", 0, 4, 4 },
X {"", 0, 3, 3 },
X {"goto !0t;", 0, 1, 1 },
X {"continue;", 0, 0, 0 },
X {"break;", 0, 0, 0 },
X {"return !0t;", 0, 1, 1 },
X {"return score = Accept;", TF_RET, 0, 0 },
X {"{if( !0t ) return score = Accept;}", TF_ONEINT|TF_RET, 1, 1 },
X {"return score = Reject;", TF_RET, 0, 0 },
X {"{if( !0t ) return score = Reject;}", TF_ONEINT|TF_RET, 1, 1 },
X {"!0t->vals[!1t]", 0, 2, 2 },
X {"!0t(!1,)", 0, 2, 2 },
X {"!0N", 0, 0, 1 },
X {"!0$", 0, 0, 1 },
X {"!0n", 0, 0, 1 },
X {"gquery(!0n)", TF_RETINT, 0, 1 },
X {"(!0t)", 0, 1, 1 },
X {"!0t++", 0, 1, 1 },
X {"!0t--", 0, 1, 1 },
X {"++!0t", 0, 1, 1 },
X {"--!0t", 0, 1, 1 },
X {"+!0t", TF_ONEINT, 1, 1},
X {"-!0t", TF_ONEINT, 1, 1 },
X {"!!!0t", TF_ONEINT|TF_RETINT, 1, 1 },
X {"!0t*!1t", TF_2INT, 2, 2 },
X {"!0t/!1t", TF_2INT, 2, 2 },
X {"!0t%!1t", TF_2INT, 2, 2 },
X {"!0t + !1t", TF_2INT, 2, 2 },
X {"!0t - !1t", TF_2INT, 2, 2 },
X {"!0t < !1t", TF_2INT|TF_RETINT, 2, 2 },
X {"!0t > !1t", TF_2INT|TF_RETINT, 2, 2 },
X {"!0t <= !1t", TF_2INT|TF_RETINT, 2, 2 },
X {"!0t >= !1t", TF_2INT|TF_RETINT, 2, 2 },
X {"", TF_RETINT, 2, 2 },
X {"", TF_RETINT, 2, 2 },
X {"", TF_RETINT, 2, 2 },
X {"", TF_RETINT, 2, 2 },
X {"", TF_RETINT, 2, 2 },
X {"", TF_RETINT, 2, 2 },
X {"!0t & !1t", TF_2INT, 2, 2 },
X {"!0t | !1t", TF_2INT, 2, 2 },
X {"!0t && !1t", TF_2INT|TF_RETINT, 2, 2 },
X {"!0t ^ !1t", TF_2INT, 2, 2 },
X {"!0t || !1t", TF_2INT|TF_RETINT, 2, 2 },
X {"!0t ? !1t : !2t", 0, 3, 3 },
X {"!0P", 0, 0, 1 },
X {"", 0, 3, 3 },
X {"", 0, 2, 2 },
X
X };
X
END_OF_FILE
if test 2344 -ne `wc -c <'comp/node.c'`; then
    echo shar: \"'comp/node.c'\" unpacked with wrong size!
fi
# end of 'comp/node.c'
fi
if test -f 'comp/node.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'comp/node.h'\"
else
echo shar: Extracting \"'comp/node.h'\" \(1447 characters\)
sed "s/^X//" >'comp/node.h' <<'END_OF_FILE'
X/* BEGIN_DEFINE */
X
X#define N_NULL 0 
X
X#define N_LIST 1 
X
X#define N_EXTERN 2 
X
X#define N_EXT_FUNC 3 
X
X#define N_DECL_VAR 4 
X
X#define N_ID 5 
X
X#define N_ROUTINE 6 
X
X#define N_LABELED 7 
X
X#define N_CASE 8 
X
X#define N_DEFAULT 9 
X
X#define N_COMPOUND 10 
X
X#define N_SEMISTAT 11 
X
X#define N_ADJUST 12 
X
X#define N_CALL 13 
X
X#define N_ASSIGN 14 
X
X#define N_IF 15 
X
X#define N_IFELSE 16 
X
X#define N_SWITCH 17 
X
X#define N_WHILE 18 
X
X#define N_FOR 19 
X
X#define N_FOREACH 20 
X
X#define N_GOTO 21 
X
X#define N_CONTINUE 22 
X
X#define N_BREAK 23 
X
X#define N_RETURN 24 
X
X#define N_ACCEPT 25 
X
X#define N_IFACCEPT 26 
X
X#define N_REJECT 27 
X
X#define N_IFREJECT 28 
X
X#define N_INDEX 29 
X
X#define N_FUNCALL 30 
X
X#define N_INT 31 
X
X#define N_STRING 32 
X
X#define N_NGROUP 33 
X
X#define N_QGROUP 34 
X
X#define N_PAREN 35 
X
X#define N_POSTINC 36 
X
X#define N_POSTDEC 37 
X
X#define N_PREINC 38 
X
X#define N_PREDEC 39 
X
X#define N_UPLUS 40 
X
X#define N_UMINUS 41 
X
X#define N_NOT 42 
X
X#define N_MULT 43 
X
X#define N_DIVIDE 44 
X
X#define N_MODULUS 45 
X
X#define N_PLUS 46 
X
X#define N_MINUS 47 
X
X#define N_LT 48 
X
X#define N_GT 49 
X
X#define N_LE 50 
X
X#define N_GE 51 
X
X#define N_EQ 52 
X
X#define N_NE 53 
X
X#define N_IN 54 
X
X#define N_NOT_IN 55 
X
X#define N_HAS 56 
X
X#define N_NOT_HAS 57 
X
X#define N_BAND 58 
X
X#define N_BOR 59 
X
X#define N_AND 60 
X
X#define N_XOR 61 
X
X#define N_OR 62 
X
X#define N_QUERY 63 
X
X#define N_PATTERN 64 
X
X#define N_PARSE 65 
X
X#define N_ARINIT 66 
X
X/* any extra defines */
END_OF_FILE
if test 1447 -ne `wc -c <'comp/node.h'`; then
    echo shar: \"'comp/node.h'\" unpacked with wrong size!
fi
# end of 'comp/node.h'
fi
if test -f 'comp/tree.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'comp/tree.h'\"
else
echo shar: Extracting \"'comp/tree.h'\" \(1964 characters\)
sed "s/^X//" >'comp/tree.h' <<'END_OF_FILE'
X
X/* Copyright 1989 Looking Glass Software Limited.  All Rights Reserved. */
X
X
Xtypedef struct node {
X	byte	ntype;			/* type of node */
X	byte	nflags;			/* flags on the node */
X	struct node *parent;		/* parent of the node */
X	unsigned short line_num;	/* line number of the node */
X	dtype	ndtype;			/* data type of the node */
X	struct node *kids[1];		/* flex array of node children */
X	} *nodep;
X
X#define NIL (nodep)0
X
X/* structure for linked lists in the tree */
X/* The main lists are lists of lines, so this is a good place to put the
X   line number information */
X
Xtypedef struct link_list {
X	byte	ntype;			/* to match regular nodes */
X	byte	nflags;			/* flags on the node */
X	struct node *parent;		/* parent of the node */
X	unsigned short	line_num;	/* line number of node in original src*/
X	nodep	kid;			/* the element in the list */
X	struct link_list *next;		/* next in the chain, or nil */
X	char	*filename;		/* original source filename */
X	} *listp;
X
Xstruct typelist {
X	byte	argmin;			/* minimum arguments that may be given*/
X	byte 	argmax;			/* max args that may be given */
X	byte	argcount;		/* number of types in the arg list */
X	dtype	*args;			/* actual list of args */
X	};
X
X
X/* Node flags */
X
X
Xstruct node_info {
X	char *printcode;		/* how to print the node */
X	int flags;
X	byte kids;			/* number of tree kids */
X	byte fullkids;			/* number of kids to alloc for */
X	};
X
X#define MAX_KIDS 4			/* max kids any tree node has */
X
X#define kid0(x)	x->kids[0]
X#define kid1(x)	x->kids[1]
X#define kid2(x)	x->kids[2]
X#define kid3(x)	x->kids[3]
X
X/* flags to cast or otherwise flag nodes */
X
X#define CAST_NGNAME 1
X#define CAST_MAILNAME 2
X#define CAST_DATE 3
X#define CAST_INT 4
X#define CAST_MASK 7
X#define NF_LVALUE 8
X#define NF_ARRASG 16			/* can be overloaded with LVALUE */
X
X/* flags indicating type structure of kids */
X
X#define TF_ONEINT 1
X#define TF_2INT 2
X#define TF_RET 4			/* this node involves return */
X#define TF_RETINT 8		/* this node always returns an int */
END_OF_FILE
if test 1964 -ne `wc -c <'comp/tree.h'`; then
    echo shar: \"'comp/tree.h'\" unpacked with wrong size!
fi
# end of 'comp/tree.h'
fi
if test -f 'comp/y.tab.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'comp/y.tab.h'\"
else
echo shar: Extracting \"'comp/y.tab.h'\" \(1015 characters\)
sed "s/^X//" >'comp/y.tab.h' <<'END_OF_FILE'
X
Xtypedef union  {
X	nodep	treeval;		/* maybe need tree and list types? */
X	char	*strval;
X	int	intval;
X} YYSTYPE;
Xextern YYSTYPE yylval;
X# define YACCEPT 257
X# define YARRAY 258
X# define YBREAK 259
X# define YCASE 260
X# define YCONTINUE 261
X# define YPARSE 262
X# define YTDATABASE 263
X# define YTDATE 264
X# define YDEFAULT 265
X# define YDUALCASE 266
X# define YELSE 267
X# define YEXTERN 268
X# define YFOR 269
X# define YGOTO 270
X# define YHEADER 271
X# define YIF 272
X# define YIN 273
X# define YHAS 274
X# define YTINT 275
X# define YTNEWSGROUP 276
X# define YREJECT 277
X# define YSWITCH 278
X# define YTUSERID 279
X# define YWHILE 280
X# define YILLCH 281
X# define YADJUST 282
X# define YPROCEDURE 283
X# define YFORWARD 284
X# define YRETURN 285
X# define YTSTRING 286
X# define EQ_OP 287
X# define NE_OP 288
X# define LE_OP 289
X# define GE_OP 290
X# define INC_OP 291
X# define DEC_OP 292
X# define AND_OP 293
X# define OR_OP 294
X# define YNEWSGROUP 295
X# define YINT 296
X# define YQUERYGROUP 297
X# define YID 298
X# define YSTRING 299
END_OF_FILE
if test 1015 -ne `wc -c <'comp/y.tab.h'`; then
    echo shar: \"'comp/y.tab.h'\" unpacked with wrong size!
fi
# end of 'comp/y.tab.h'
fi
if test -f 'db.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'db.h'\"
else
echo shar: Extracting \"'db.h'\" \(1978 characters\)
sed "s/^X//" >'db.h' <<'END_OF_FILE'
X/*
X * db.h
X *
X * Interface definitions for the database manager.
X * Copyright (c) 1989 Looking Glass Software Limited.
X *
X */
X
Xtypedef struct _dbr {
X	char *key;			/* Ptr to the storage key.	    */
X	struct _dbr *next;		/* Ptr to next hash bucket.	    */
X	unsigned char flags;		/* Flags -- facts about the bucket. */
X	} dbrec;
X
Xtypedef struct {
X	unsigned int tbl_size;		/* Table size of the database.	    */
X	unsigned int item_size;		/* Size of data items in database.  */
X	unsigned long n_elements;	/* Number of elements in database.  */
X	unsigned char flags;		/* Flags with info about database.  */
X	dbrec **table;			/* Table of ptrs to hash chains.    */
X	} db_t;
X
Xtypedef db_t *dbptr;
X
Xextern dbptr init_db AC((unsigned int, unsigned int));	/* Initialize dbase */
Xextern int   free_db AC((dbptr));			/* Free dbase */
X#define	     isdirty_db(db)  (db->flags & DB_DIRTY)	/* Was dbase changed? */
X#define	     dirty_db(db)    (db->flags |= DB_DIRTY)	/* Set dirty status */
X#define	     clean_db(db)    (db->flags &= ~DB_DIRTY)	/* Reset dirty status */
X#define	     size_db(db)     db->n_elements		/* Get database size */
X
Xextern dbrec *add_rec AC((dbptr, char *, int));		/* Add record  */
Xextern int    del_rec AC((dbptr, char *));		/* Delete record */
Xextern dbrec *get_rec AC((dbptr, char *));		/* Retrieve record */
Xextern dbrec *first_rec AC((dbptr));			/* Get first record */
X#define	      next_rec(db,rec)	rec->next		/* Get next record */
X
X/*
X * Flags/modes affecting the behavior of add_rec():
X */
X
X#define AR_CREATE	0x01		/* Create or replace key in dbase. */
X#define AR_NEWONLY	0x02		/* Do not replace key; return NULL. */
X#define AR_NOALLOC	0x80		/* Do not allocate and copy key. */
X
X
X/*
X * Flags contained in the dbrec.flags field:
X */
X
X#define RF_LAST		0x01		/* Last bucket in hash chain. */
X#define RF_STATIC	0x02		/* Key is located in static memory. */
X
X/*
X * Flags contained in the db_t.flags field:
X */
X
X#define DB_DIRTY	0x01		/* New record was added to dbase */
END_OF_FILE
if test 1978 -ne `wc -c <'db.h'`; then
    echo shar: \"'db.h'\" unpacked with wrong size!
fi
# end of 'db.h'
fi
if test -f 'debug.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'debug.h'\"
else
echo shar: Extracting \"'debug.h'\" \(441 characters\)
sed "s/^X//" >'debug.h' <<'END_OF_FILE'
X
X#ifdef DEBUG
X
X#define debug0(x)  if( debug ) fprintf( debstr, x )
X#define debug1(a,b)  if( debug ) fprintf( debstr, a,b )
X#define debug2(a,b,c)  if( debug ) fprintf( debstr, a,b,c )
X#define debug3(a,b,c,d)  if( debug ) fprintf( debstr, a,b,c,d )
X#define debug4(a,b,c,d,e)  if( debug ) fprintf( debstr, a,b,c,d,e )
X
X#else
X
X#define debug0(x)
X#define debug1(a,b)
X#define debug2(a,b,c)
X#define debug3(a,b,c,d)
X#define debug4(a,b,c,d,e)
X
X#endif
END_OF_FILE
if test 441 -ne `wc -c <'debug.h'`; then
    echo shar: \"'debug.h'\" unpacked with wrong size!
fi
# end of 'debug.h'
fi
if test -f 'distlist' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'distlist'\"
else
echo shar: Extracting \"'distlist'\" \(1333 characters\)
sed "s/^X//" >'distlist' <<'END_OF_FILE'
X# The 'distlist' file.  This file measures the size of various distributions,
X# in sites.  Put all distributions that contain your site in this file, along
X# with a guess of the number of sites in the distribution.  It doesn't matter
X# if the guess is accurate, just that the results are ordered.
X#
X# These are real global usenet distributions which you can probably leave
X# as is
Xworld		12000
Xusenet		11100
Xcomp		11000
Xrec		10000
Xtalk		9000
Xsci		11000
Xnews		11000
Xmisc		10500
Xsoc		10000
Xnet		11000
Xna		9000
X# You can, if desired specify distribution for a specific group
Xnews.config	11100
X# This is the first of the generic distributions listed in the manual which
X# you must define
Xcontinent	9000
Xeunet		3000
Xclari		1000
Xalt		5000
Xbiz		400
X# Some national distributions are here that might not be your country.
X# it does not, however, hurt to have the present.
Xcan		900
X# update this one to the size of your national distribution
Xcountry		900
Xaus		400
Xusa		8000
X# Replace this one with your own state or province, and update the
X# 'state' and 'province' codes.
Xont		500
Xstate		500
Xprovince	500
X# Replace these with your own regional distribution names and sizes
Xkw		60
Xregion		60
Xcity		60
X# Likewise for your oganizational and local distributions
Xuw		50
Xorganization	50
Xdepartment	40
Xsubnet		10
X# leave this one like this
Xlocal		1
END_OF_FILE
if test 1333 -ne `wc -c <'distlist'`; then
    echo shar: \"'distlist'\" unpacked with wrong size!
fi
# end of 'distlist'
fi
if test -f 'distr' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'distr'\"
else
echo shar: Extracting \"'distr'\" \(969 characters\)
sed "s/^X//" >'distr' <<'END_OF_FILE'
X: Make a tar distribution of NewsClip to stdout
XSRCS="header.c nllib.c main.c article.c nrc.c flist.c \
X	whoami.c db.c userlib.c userdb.c group.c alloc.c \
X	has.c scanbody.c regexp.c pipe.c mkdat.c"
XMKNSRCS="mknewsrc.c"
XEXTRAS="getdate.y Makefile READ.ME distlist guide nctest.nc Licence distr"
XCOMPSRC="comp/art.c comp/check.c comp/clib.c comp/hlist.c comp/lex.c \
X	comp/ncc.c comp/node.c comp/out.c comp/predef.c \
X	comp/symtab.c comp/tree.c comp/wrdata.c comp/nl.y \
X	comp/node.m4 \
X	comp/cfuncs.h comp/common.h comp/nc.h comp/node.h comp/tree.h \
X	comp/ucode.h comp/y.tab.h comp/Makefile"
XDOCS="doc/*.1 doc/man.mm doc/append.mm doc/filter.man"
X( cd doc; sh mknr )
Xrm Makefile comp/Makefile
Xln Makefile.dist Makefile
Xln comp/Makefile.dist comp/Makefile
Xtar cf - About $DOCS $SRCS $MKNSRCS $EXTRAS *.h sysdefs.??* samples/* patch/* \
X	$COMPSRC | compress >/v/claripub/nc.tar.Z
Xrm Makefile comp/Makefile
Xln Makefile.local Makefile
Xln comp/Makefile.local comp/Makefile
END_OF_FILE
if test 969 -ne `wc -c <'distr'`; then
    echo shar: \"'distr'\" unpacked with wrong size!
fi
chmod +x 'distr'
# end of 'distr'
fi
if test ! -d 'doc/' ; then
    echo shar: Creating directory \"'doc/'\"
    mkdir 'doc/'
fi
if test -f 'doc/mknewsrc.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'doc/mknewsrc.1'\"
else
echo shar: Extracting \"'doc/mknewsrc.1'\" \(3106 characters\)
sed "s/^X//" >'doc/mknewsrc.1' <<'END_OF_FILE'
X.TH MKNEWSRC 1
X.SH NAME
Xmknewsrc - Generates new .newsrc files.
X.SH SYNOPSIS
X.B mknewsrc
X[ +n ] [ n=newsrc ] [ p=percentage ] [ patterns ] 
X.SH DESCRIPTION
X.I Mknewsrc
Xis part of the NewsClip(TM) package, and is a utility which generates a
X.newsrc format file containing some subset of the newsgroups found in the
Xsystem's active news file.  The generated output, written to stdout, is
Xintended for use in conjunction with the other
X.I NewsClip
Xsoftware tools.
X.PP
X.I Mknewsrc
Xoperates in one of two "modes".  The default mode generates a newsrc style
Xfile containing one line for each newsgroup found in the system's active
Xnews file.  Group names are output in the order that they are found in the
Xactive file.  The second mode, specified by the +n or n= options, reads an
Xexisting newsrc file and generates group names for only those groups found
Xin the original newsrc file, in the original order.  Lines in the newsrc
Xfile that do not correspond to newsgroup names are quietly ignored.
XBoth modes limit the listed newsgroups according to any command line
Xpatterns that have been specified.
X.SH OPTIONS
X(Note that while option names are displayed here in full, only the first
Xletter is actually required.  For +/\- options, using + turns the option on,
Xand using \- turns the option off.)
X.TP
X.B Percentage=% of articles to mark as unread
XThe specification of this option marks all but the given percentage
X(approximately) of articles in each group as read.  The argument value
Xmust be an integer, from 0 to 100 inclusive;  values out of this range
Xare reset to the appropriate extreme.  By default, all available
Xarticles are marked as unread in the created newsrc file; this corresponds
Xto specifying p=100 on the command line.  The percentage is computed on
Xthe basis of the number of articles currently available in each
Xnewsgroup, according to the active file.  Hence, specifying p=20 will
Xmark all but the most recent twenty percent of the articles in each group
Xas read.
X.TP
X.B +n
XThis option causes
X.I mknewsrc
Xto search for the user's existing .newsrc file, and if found, place only
Xgroups found in it on the output stream.  The .newsrc file is searched for
Xin the directory containing the user's dot files, which is the home
Xdirectory unless the environment variable DOTDIR is defined at the time of
Xprogram invocation.
X.TP
X.B Newsrc=path
XThis option is effectively the same as the +n option described above.
XThe key difference is that an explicit path for the existing .newsrc
Xfile can (and must) be specified when this form of the option is used.
X.SH AUTHOR
X.PP
XThe
X.I Newsclip
Xsystem was written by Brad Templeton and Tim Tyhurst.  It is copyright
X1989 by Looking Glass Software Limited.  All rights reserved.
XIt is a commercial product and is only to be used by authorized, licenced
Xusers who have purchased or arranged a licence with the copyright owner.
XThese programs and their associated documentation are not to be copied for
Xuse by unlicenced parties.
X.SH FILES
X/usr/lib/news/active,
X~/.newsrc
X.SH "SEE ALSO"
X.I nclip(1),
X.I ncc(1),
X.I rn(1),
X.I readnews(1)
X.SH VERSION
XVersion 1.0
END_OF_FILE
if test 3106 -ne `wc -c <'doc/mknewsrc.1'`; then
    echo shar: \"'doc/mknewsrc.1'\" unpacked with wrong size!
fi
# end of 'doc/mknewsrc.1'
fi
if test -f 'flist.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'flist.c'\"
else
echo shar: Extracting \"'flist.c'\" \(773 characters\)
sed "s/^X//" >'flist.c' <<'END_OF_FILE'
X
X/*
X * The main loop for processing articles that come in a list on
X * stdin.  (mode=filter option)
X */
X
X#include "nl.h"
X
Xint reading_mode = FILE_FULL;		/* style of reading from files */
X
Xdo_file_list()
X{
X	char buf[MAX_FNAME];		/* buffer for file name */
X	int len;
X	extern int article_number;
X	extern newsgroup main_newsgroup;
X
X
X	initngs(FALSE);
X
X	reading_mode = FILE_FULL;
X
X	Uinit();
X
X
X	while( fgets( buf, sizeof(buf), stdin ) ) {
X		len = strlen( buf );
X		if( len == 0 || buf[len-1] != '\n' )
X			warning( 1, "Invalid filename %s\n", buf );
X		 else
X			buf[--len] = 0;
X		reset_tempalloc();
X		/* accept all and reject all don't apply here */
X		article_number = 0;
X		main_newsgroup = NULL_NEWSGROUP;
X		if( accept_article(buf) )
X			printf( "%s\n", buf );
X		}
X	Uterminate();
X
X}
END_OF_FILE
if test 773 -ne `wc -c <'flist.c'`; then
    echo shar: \"'flist.c'\" unpacked with wrong size!
fi
# end of 'flist.c'
fi
if test -f 'funcs.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'funcs.h'\"
else
echo shar: Extracting \"'funcs.h'\" \(902 characters\)
sed "s/^X//" >'funcs.h' <<'END_OF_FILE'
X/*
X * Function prototype definitions 
X */
X
Xextern	int lowercase AC((char *));
Xextern	char *whitestrip AC((char *));
Xextern	char *perm_alloc AC((unsigned int ));
Xextern	char *white_delim_strip AC((char *, char));
Xextern	char *temp_alloc AC((unsigned int ));
Xextern	char *temp_realloc AC((char *, unsigned int, unsigned int ));
Xextern	char *allocstring AC((char *));
Xextern	char *temp_string AC((char *));
Xextern	char *strchr AC(( const char *, int ));
Xextern	char *ngdir AC(( char * ));
Xextern	char *pathform AC(( char *, char * ));
X
Xextern	array *parse_array AC(( char*, char *, int ));
Xextern	array *fresh_array AC(( int, int ));
X
Xextern	int32 atoi32 AC(( char * ));
X
Xextern	FILE *mustopen AC(( char *, char *, char * ));
Xextern	FILE *dfopen AC(( char *, char *, char * ));
X
X
Xextern char *dotdir;			/* user's dir for . files */
Xextern char *news_lib_dir;
X
Xextern FILE *dbopen AC(( char *, char * ));
X
END_OF_FILE
if test 902 -ne `wc -c <'funcs.h'`; then
    echo shar: \"'funcs.h'\" unpacked with wrong size!
fi
# end of 'funcs.h'
fi
if test -f 'guide' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'guide'\"
else
echo shar: Extracting \"'guide'\" \(3009 characters\)
sed "s/^X//" >'guide' <<'END_OF_FILE'
X
X		Guide to the files in the distribution:
X
X
X			News Library Source Code
X
Xheader.c	Parse article headers
Xnllib.c		General library of tool functions used within the library
Xmain.c		Main entry point and option processing
Xarticle.c	Master routine to process an article
Xnrc.c		Routines to process a .newsrc and associated files
Xflist.c		Routines to handle filter mode
Xwhoami.c	System dependent information routines
Xdb.c		General ram database package
Xuserlib.c	User library routines
Xuserdb.c	User library database routines
Xgroup.c		Code to handle newsgroup names and associated material
Xalloc.c		Temporary allocator and other allocation code
Xhas.c		Has operator code
Xscanbody.c	Has operator code applied to text regions	
Xregexp.c	Regular expression handler
Xpipe.c		Pipe mode interface
Xgetdate.y	USENET date format yacc parser
X
Xbody.h		Article body sections
Xcommon.h	Included by both compiler and library
Xdb.h		Database library definitions
Xdebug.h		Debugging definitions
Xfuncs.h		Function declarations and prototypes
Xnl.h		Master include file for news library
Xpipemode.h	Pipe definitions
Xregmagic.h	Regular expression metacharacters
Xrei.h		More Regular expression definitions
Xrxp.h		More Regular expression definitions
Xsysdefs.h	File of ststem dependent definitions
Xthevars.h	The header variables
Xucode.h		The include file for user programs
X
Xsysdefs.v7	Version of sysdefs.h for Unix V7 and old BSD systems
Xsysdefs.sysv	Version of sysdefs.h for System III, System V & Xenix/386
Xsysdefs.bsd	Version of sysdefs.h for 4BSD systems
Xsysdefs.x286	Version of sysdefs.h for Xenix/286
X
X			Newsrc Building Program
X
Xmknewsrc.c	Source to .newsrc making program
X
X			Extra Files
X
XMakefile	Master make file
XREAD.ME		Brief introduction
XLicence		NewsClip evaluation terms, conditions and prices
XAbout		About NewsClip
X
Xdistlist	Sample distribution list
Xguide		Guess
X
X			Compiler Source
X
Xcomp/art.c
Xcomp/check.c	Type checking
Xcomp/clib.c	Compiler library
Xcomp/hlist.c	Handle references to header items
Xcomp/lex.c	Scanner
Xcomp/ncc.c	Main entry point and option processor
Xcomp/node.c	Various information about tree nodes
Xcomp/out.c	"Code Generator" -- outputs C.
Xcomp/predef.c	Table of predefined user symbols
Xcomp/symtab.c	Symbol table and procedure/function routines
Xcomp/tree.c	General tree manipulation code
Xcomp/wrdata.c	Output of data tables to user program.
Xcomp/nl.y	Parser, in yacc format
X
Xcomp/node.m4	Tree node information in M4 format
Xcomp/nsplit00	Special link for splitting out m4 output
Xcomp/nsplit01	Special link for splitting out m4 output
X
Xcomp/cfuncs.h	Function definitions and prototypes
Xcomp/common.h	Common includes for compiler and library
Xcomp/nc.h	Master include for compiler
Xcomp/node.h	Node number definitions
Xcomp/tree.h	Tree structure definitions
Xcomp/Makefile	Compiler makefile
X
X
X			Directories
X
Xdoc		Manual, man pages, protocol descriptions and general docs
Xsamples		Sample and prototype newsclip programs for the users
Xpatch		Pipe protocol code and instructions on how to adapt
X		newsreaders such as RN.
X
END_OF_FILE
if test 3009 -ne `wc -c <'guide'`; then
    echo shar: \"'guide'\" unpacked with wrong size!
fi
# end of 'guide'
fi
if test -f 'mkdat.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mkdat.c'\"
else
echo shar: Extracting \"'mkdat.c'\" \(86 characters\)
sed "s/^X//" >'mkdat.c' <<'END_OF_FILE'
X
Xmain()
X{
X	long time();	/* no see */
X	printf( "%ld\n", time((long *)0) );
X	exit(0);
X}
END_OF_FILE
if test 86 -ne `wc -c <'mkdat.c'`; then
    echo shar: \"'mkdat.c'\" unpacked with wrong size!
fi
# end of 'mkdat.c'
fi
if test -f 'nctest.nc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nctest.nc'\"
else
echo shar: Extracting \"'nctest.nc'\" \(136 characters\)
sed "s/^X//" >'nctest.nc' <<'END_OF_FILE'
X
X/* Sample program rejects all crossposted articles, accepts single-posts */
X
Xprocedure article()
X{
X	reject if count(newsgroups) > 1;
X}
END_OF_FILE
if test 136 -ne `wc -c <'nctest.nc'`; then
    echo shar: \"'nctest.nc'\" unpacked with wrong size!
fi
# end of 'nctest.nc'
fi
if test -f 'nl.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'nl.h'\"
else
echo shar: Extracting \"'nl.h'\" \(1899 characters\)
sed "s/^X//" >'nl.h' <<'END_OF_FILE'
X
X
X#include "common.h"
X#include "db.h"
X#include "funcs.h"
X/* The union that describes the various possible data types */
X
X
X/* database structure */
X
Xtypedef struct db_record {
X	char *name;
X	struct db_record *next;
X	byte hflags;
X	int intval;			/* the cell's value */
X	datehold access_date;		/* last time of access */
X	} userdb;
X
Xtypedef struct ng_record {
X	char *key;		/* name of newsgroup */
X	struct ng_record *next;
X	char flags;
X	char gflag;		/* flags for the group */
X	int16 ngnumber;		/* newsgroup number */
X	int32 lowest;		/* lowest art, from active file */
X	int32 highest;		/* highest from active file */
X	int32 las;		/* last article seen */
X	short chain;		/* chain in order of .newsrc */
X	short distribution;	/* distribution number for this newsgroup */
X	char *seenlist;		/* list of articles seen from .newsrc */
X	int16 slistlen;		/* length of seen list */
X	} ngrec;
X
X#define iswhite(x) (strchr(" \t", x)!=0)
X/* newsgroup name macro */
Xextern ngrec **ngarray;
X#define ngn(x)	ngarray[x]->key		/* news group name */
X
X/* flags for article routine */
X#define A_FILE 0
X#define A_PIPE 1
X
X/* flags on groups */
X
X#define GF_DIRTY 1
X#define GF_ACTIVE 2
X#define GF_LASGROUP 4		/* found in LAS file */
X#define GF_UNSUB 8		/* unsubscribed group */
X#define GF_RCGROUP 16		/* found in .newsrc file */
X
X/* modes of operation */
X#define MODE_NONE 0		/* no mode specified */
X#define MODE_NEWSRC 1		/* read and write a .newsrc */
X#define MODE_FLIST 2		/* read and write file list on stdin/stdout */
X#define MODE_PIPE 3		/* converse with a newsreader */
X
X/* reading modes */
X#define FILE_FULL 1
X#define FILE_REQUEST 2
X#define PIPE_READ 3
X
X#define ERRCODE -1		/* error code in pipe routines */
X
X#define NULL_NEWSGROUP 0
X#define NG_EXTRAS 20		/* extra negative newsgroup numbers */
X#define SLIST_EXTRAS 15		/* extra bytes to allocate for seen lists */
X#define STRIP_CODE	'S'	/* white space strip delimiter code */
X
END_OF_FILE
if test 1899 -ne `wc -c <'nl.h'`; then
    echo shar: \"'nl.h'\" unpacked with wrong size!
fi
# end of 'nl.h'
fi
if test ! -d 'patch/' ; then
    echo shar: Creating directory \"'patch/'\"
    mkdir 'patch/'
fi
if test -f 'patch/pipemode.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patch/pipemode.h'\"
else
echo shar: Extracting \"'patch/pipemode.h'\" \(991 characters\)
sed "s/^X//" >'patch/pipemode.h' <<'END_OF_FILE'
X
X
X/* Definitions for News Filter pipe mode */
X
X/* Unlike the other files in the NewsClip distribution, this file and
X * 'filtpipe.c' are released to the public domain.
X */
X
X
X#define AS_SIZE 3
X#define SEQ_SIZE 6			/* adjust to make struct even bound */
X#ifdef MAX_LLEN
X# define MAX_ARGLEN MAX_LLEN
X#else
X# define MAX_ARGLEN 255
X#endif
X
X#define TRUE 1
X#define FALSE 0
X
X	/* struct for start of message */
X
Xstruct command {
X	char comtype;			/* message type, usually 'C' */
X	char comcode;			/* command code */
X	char space;			/* the delimiting space */
X	char seq_num[SEQ_SIZE];		/* sequence number plus 0 */
X	char space2;			/* extra space */
X	char arg_size[AS_SIZE];		/* argument size */
X	char zerob;			/* a zero byte */
X	};
X
X#define MAX_ARGS 40			/* max arguments to a command */
X
X#define ABASE 1				/* first real argument */
X
X/* The pipes we use to talk to the reader (filter end)*/
X
X#define F_COMPIPE 0		/* stdin */
X#define F_ANSPIPE 1		/* stdout */
X
X#ifndef NULL
X#define NULL (char *)0
X#endif
END_OF_FILE
if test 991 -ne `wc -c <'patch/pipemode.h'`; then
    echo shar: \"'patch/pipemode.h'\" unpacked with wrong size!
fi
# end of 'patch/pipemode.h'
fi
if test -f 'pipemode.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pipemode.h'\"
else
echo shar: Extracting \"'pipemode.h'\" \(991 characters\)
sed "s/^X//" >'pipemode.h' <<'END_OF_FILE'
X
X
X/* Definitions for News Filter pipe mode */
X
X/* Unlike the other files in the NewsClip distribution, this file and
X * 'filtpipe.c' are released to the public domain.
X */
X
X
X#define AS_SIZE 3
X#define SEQ_SIZE 6			/* adjust to make struct even bound */
X#ifdef MAX_LLEN
X# define MAX_ARGLEN MAX_LLEN
X#else
X# define MAX_ARGLEN 255
X#endif
X
X#define TRUE 1
X#define FALSE 0
X
X	/* struct for start of message */
X
Xstruct command {
X	char comtype;			/* message type, usually 'C' */
X	char comcode;			/* command code */
X	char space;			/* the delimiting space */
X	char seq_num[SEQ_SIZE];		/* sequence number plus 0 */
X	char space2;			/* extra space */
X	char arg_size[AS_SIZE];		/* argument size */
X	char zerob;			/* a zero byte */
X	};
X
X#define MAX_ARGS 40			/* max arguments to a command */
X
X#define ABASE 1				/* first real argument */
X
X/* The pipes we use to talk to the reader (filter end)*/
X
X#define F_COMPIPE 0		/* stdin */
X#define F_ANSPIPE 1		/* stdout */
X
X#ifndef NULL
X#define NULL (char *)0
X#endif
END_OF_FILE
if test 991 -ne `wc -c <'pipemode.h'`; then
    echo shar: \"'pipemode.h'\" unpacked with wrong size!
fi
# end of 'pipemode.h'
fi
if test -f 'regmagic.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'regmagic.h'\"
else
echo shar: Extracting \"'regmagic.h'\" \(153 characters\)
sed "s/^X//" >'regmagic.h' <<'END_OF_FILE'
X/*
X * The first byte of the regexp internal "program" is actually this magic
X * number; the start node begins in the second byte.
X */
X#define	MAGIC	0234
END_OF_FILE
if test 153 -ne `wc -c <'regmagic.h'`; then
    echo shar: \"'regmagic.h'\" unpacked with wrong size!
fi
# end of 'regmagic.h'
fi
if test -f 'rei.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rei.h'\"
else
echo shar: Extracting \"'rei.h'\" \(987 characters\)
sed "s/^X//" >'rei.h' <<'END_OF_FILE'
X/*
X * rei.h
X *
X * Regular expression handler interface.  Unfortunately, more than simply 
X * altering these definitions may be required to substitute an alternate
X * regular expression compilation/execution package, mostly due to the
X * notions of how memory allocation is handled.  Of course, the RE syntax
X * itself may vary as well.
X *
X */
X
X/* Interface to Henry Spencer's [slightly modified] regexp(3) package.  */
X
X#include "rxp.h"
X
X#define	REG_COMP_T(exp)    regcomp(exp,RXP_MEM_TEMP) /* Compile a temp. RE */
X#define	REG_COMP_P(exp)    regcomp(exp,RXP_MEM_PERM) /* Compile a perm. RE */
X#define REG_COMP_S(exp)	   regcomp(exp,RXP_MEM_STAT) /* Compile a static RE */
X#define	REG_EXEC(prog,str) regexec(prog,str)	     /* Execute an RE */
X#define REG_FREE_T(prog)   			     /* Free a temp. RE */
X#define REG_FREE_P(prog)   perm_free(prog)	     /* Free a perm. RE */
X#define REG_FREE_S(prog)			     /* Free a static RE */
X
Xtypedef regexp *rxp_type;	/* Type handle for compiled REs */
END_OF_FILE
if test 987 -ne `wc -c <'rei.h'`; then
    echo shar: \"'rei.h'\" unpacked with wrong size!
fi
# end of 'rei.h'
fi
if test -f 'rxp.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rxp.h'\"
else
echo shar: Extracting \"'rxp.h'\" \(670 characters\)
sed "s/^X//" >'rxp.h' <<'END_OF_FILE'
X/*
X * Definitions etc. for regexp(3) routines.
X *
X * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
X * not the System V one.
X */
X#define NSUBEXP  10
Xtypedef struct regexp {
X	char *startp[NSUBEXP];
X	char *endp[NSUBEXP];
X	char regstart;		/* Internal use only. */
X	char reganch;		/* Internal use only. */
X	char *regmust;		/* Internal use only. */
X	int regmlen;		/* Internal use only. */
X	char program[1];	/* Unwarranted chumminess with compiler. */
X} regexp;
X
Xextern regexp *regcomp();
Xextern int regexec();
Xextern void regsub();
Xextern void regerror();
Xextern void regwarning();
X
X#define RXP_MEM_PERM	0
X#define RXP_MEM_TEMP	1
X#define RXP_MEM_STAT	2
END_OF_FILE
if test 670 -ne `wc -c <'rxp.h'`; then
    echo shar: \"'rxp.h'\" unpacked with wrong size!
fi
# end of 'rxp.h'
fi
if test ! -d 'samples/' ; then
    echo shar: Creating directory \"'samples/'\"
    mkdir 'samples/'
fi
if test -f 'thevars.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'thevars.h'\"
else
echo shar: Extracting \"'thevars.h'\" \(484 characters\)
sed "s/^X//" >'thevars.h' <<'END_OF_FILE'
Xextern	char	*message_id;
Xextern	usename	*approved;
Xextern	char	*control;
Xextern	time_t	date_posted;
Xextern	char	*distribution;
Xextern	time_t	expires;
Xextern	array	*followup_to;
Xextern	usename	*from;
Xextern	array	*keywords;
Xextern	int	lines;
Xextern	array	*newsgroups;
Xextern	char	*organization;
Xextern	array	*path;
Xextern	char	*posting_version;
Xextern	array	*references;
Xextern	usename	*reply_to;
Xextern	usename	*sender;
Xextern	char	*subject;
Xextern	char	*summary;
Xextern	array	*xref;
END_OF_FILE
if test 484 -ne `wc -c <'thevars.h'`; then
    echo shar: \"'thevars.h'\" unpacked with wrong size!
fi
# end of 'thevars.h'
fi
echo shar: End of archive 1 \(of 15\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 15 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0