[comp.os.minix] Vn for Minix, part 4 of 4

nick@ultima.cs.uts.oz (Nick Andrew) (11/26/89)

#! /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 shell archive."
# Contents:  userlist.c vn.c vn.h vn.man vnglob.c
# Wrapped by nick@ultima on Sun Nov 26 22:17:13 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'userlist.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'userlist.c'\"
else
echo shar: Extracting \"'userlist.c'\" \(2262 characters\)
sed "s/^X//" >'userlist.c' <<'END_OF_FILE'
X/*
X** vn news reader.
X**
X** userlist.c - generate user's list of articles
X**
X** see copyright disclaimer / history in vn.c source file
X*/
X
X#include <stdio.h>
X#include "tune.h"
X#include "node.h"
X#include "page.h"
X#include "vn.h"
X
Xextern PAGE Page;
Xextern char *List_sep;
X
X#ifndef	MINIX
Xstatic char Pattern[MAX_C] = "";
X#else
X/* Minix, in its C compiler wisdom(?), only defines 1 word for the above */
Xstatic char Pattern[MAX_C] = {0};
X#endif
X
X/*
X	generate user list of articles - either article numbers
X	are input directly (numeric list), or input is a search
X	string - invoke regular expression library and examine titles
X	search string "*" reserved for marked articles.  Strings may
X	be prefixed with '!' for negation.
X*/
Xuserlist (list)
Xchar *list;
X{
X	int i,j,anum[RECLEN/2],acount;
X	char neg, *s, sbuf[MAX_C+1], *reg, *regex(), *regcmp(), *index(), *strtok();
X
X	user_str (sbuf,"Articles or title search string : ",1,Pattern);
X	if (sbuf[0] == '!')
X	{
X		neg = '!';
X		s = sbuf+1;
X	}
X	else
X	{
X		neg = '\0';
X		s = sbuf;
X	}
X	for (i=0; s[i] != '\0'; ++i)
X	{
X		if (index(List_sep,s[i]) == NULL)
X		{
X			if (s[i] < '0' || s[i] > '9')
X				break;
X		}
X	}
X	acount = 0;
X
X	if (s[i] == '\0')
X	{
X		for (s = strtok(s,List_sep); s != NULL; s = strtok(NULL,List_sep))
X		{
X			anum[acount] = atoi(s);
X			++acount;
X		}
X	}
X	else
X	{
X		/* we save old input only if NOT a list of article numbers */
X		strcpy(Pattern,sbuf);
X		if (s[0] == ART_MARK)
X		{
X			for (i=0; i < Page.h.artnum; ++i)
X			{
X				if (Page.b[i].art_mark != ' ')
X				{
X					anum[acount] = Page.b[i].art_id;
X					++acount;
X				}
X			}
X		}
X		else
X		{
X			reg = regcmp(s,(char *) 0);
X			if (reg != NULL)
X			{
X				for (i=0; i < Page.h.artnum; ++i)
X				{
X					if (regex(reg,Page.b[i].art_t) != NULL)
X					{
X						anum[acount] = Page.b[i].art_id;
X						++acount;
X					}
X				}
X				regfree (reg);
X			}
X			else
X				preinfo ("bad regular expression syntax");
X		}
X	}
X
X	/* algorithm is inefficient, but we're only handling a few numbers */
X	*list = '\0';
X	for (i=0; i < Page.h.artnum; ++i)
X	{
X		for (j=0; j < acount && anum[j] != Page.b[i].art_id; ++j)
X			;
X		if (neg == '!')
X		{
X			if (j < acount)
X				continue;
X		}
X		else
X		{
X			if (j >= acount)
X				continue;
X		}
X		sprintf (list,"%d ",Page.b[i].art_id);
X		list += strlen(list);
X	}
X}
END_OF_FILE
if test 2262 -ne `wc -c <'userlist.c'`; then
    echo shar: \"'userlist.c'\" unpacked with wrong size!
fi
# end of 'userlist.c'
fi
if test -f 'vn.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'vn.c'\"
else
echo shar: Extracting \"'vn.c'\" \(9884 characters\)
sed "s/^X//" >'vn.c' <<'END_OF_FILE'
X/*
Xvn news reader for visual page oriented display of news
Xaimed at scanning large numbers of articles.
X
XOriginal program by Bob McQueer in several versions 1983-1986.  Released
Xinto the public domain in 1986.  While no copyright notice appears, the
Xoriginal author asks that a history of changes crediting the proper people
Xbe maintained.
X
XBob McQueer
X{amdahl, sun, mtxinu, hoptoad, cpsc6a}!rtech!bobm
X
XHistory:
X
X	(bobm@rtech) 5/86 - first "public" version
X
X	(bobm@rtech) 12/86 - version incorporates:
X
X		bug fixes:
X			str_store NULL string bug
X			not picking up first article in newsgroup
X			RESTART terminal reset for exit to editor.
X			skip whitespace in "empty" digest lines while unpacking
X			DISTRIBUTION line in followups.
X			:100%: prompt on last line in reader.
X			interpretation of multiple negations -w -t options.
X
X			Many thanks to several people who noted the first
X			two bugs as well as fixes.
X
X			Thank you to Karl Williamson for helpful information
X			tracking down the "concept terminal" bug (RESTART).
X
X		SYSV ifdef's adapted from those done by Larry Tepper
X		at ATT Denver - sent in by Karl Williamson, drutx!khw.
X		Many people submitted SYSV ifdef's - thank you all.
X
X		print capability from reader from Karl Williamson,
X		drutx!khw
X
X		Changes to use alternate header lines for mail, from changes
X		by Andy Marrinson, andy@icom.UUCP (ihnp4!icom!andy).  Ifdef'ed
X		to allow local configuration (bobm@rtech).
X
X		"author_copy" file for followups, prevention of multiple
X		"re: "'s, insert blank line and original author line
X		before excerpted text from Andy Marrinson, andy@icom.UUCP
X
X		Search string capability in reader, from Lawrie Brown,
X		seismo!munnari!cdsadfa.oz!lpb (Australia).  Somewhat
X		modified by interaction with the :100%: bug.
X
X		Arrow key support, adapted from changes by Lawrie Brown.
X		Modified to simply not allow control keys for arrows (allowing
X		SOME controls is too prone to problems, esp. with .vnkey), and
X		to allow the PAGEARROW ifdef (bobm@rtech)
X
X		prevention of followups to "mod" and "announce", from
X		Lawrie Brown.
X
X		OLDRC ifdef adapted from changes by Lawrie Brown.  ADDRMUNGE
X		added to allow OZ domain addressing changes from Australia
X		to be grafted back in, and provide a hook for anybody else
X		wanting to do something similar.
X
X		Bob McQueer, bobm@rtech:
X
X			a menu selection from the % command to jump to
X			a new newsgroup
X
X			linked list on hash table - no longer a compiled
X			in limit for number of newsgroups
X
X			.vnkey keystroke mapping file.
X
X			options to get the % command list on entry, and to
X			change how unsubscribed groups are handled for updates.
X
X			allow configurable use of vs / ve pair for terminal
X			handling.
X
X	8/87 (bobm@rtech)
X
X		Server interface changes.  Creation of vns_xxx routines
X		formally defining how to attach vn to an abstracted
X		news server, rearranged existing code to use that
X		abstraction.  Sourcefile list altered a good bit by
X		the rearrangement.  Some of this was splitting some
X		routines out from vn.c into smaller modules.  Reader
X		code was altered a good bit to work through the
X		ARTHEADER abstraction, rather than searching for
X		header lines.  Temp file writing code was the other
X		area heavily affected.  The std.c server interface
X		essentially incorporates the old newsrc.c code, plus
X		the old outgroup() and gethead() routines.
X
X		vns_changes also included:
X
X			Modification of mailer interface for MAILCHOOSE,
X			getting rid of ADDRMUNGE (superseded by vns
X			interface definition)
X
X			Moved readstr() into the session loop code,
X			allowing a lot of static declarations to be
X			placed therein.  Also made it possible to
X			use strtok() underneath readstr().
X
X			Made "save" write directly into file, rather
X			than forking a cat (gee, that sounds perverse).
X
X			Also fixes it so that "|" save convention works
X			from reader.
X
X			Digest unpacking has to know about header lines,
X			unfortunately, so it has local definitions for
X			some header lines.
X
X		Incorporates:
X
X			The much-discussed "continued header line" bug
X			fix, of course.  Includes the multiple header
X			line nfgets() by Andrew Worsley, andrew@munnari.oz,
X			with a couple cosmetic changes.
X
X			Top / Middle / Bottom keys from Karl Williamson
X			print capability from reader from Karl Williamson,
X			drutx!khw
X
X			Edit old save file changes from George Pavel,
X			gp@lll-lcc.arpa.  Used it to allow edit of
X			the some other old strings, too.
X
X			Fix for the bad number input bug on the choose
X			new group from list feature, as reported by
X			Dave Tallman, tallman@hc.arpa.  His fix with
X			a few minor changes.
X
X			A couple save file tweaks - allow a "%s" in VNSAVE
X			to specify individual directories by newsgroup.
X			Allow a "w:" prefix on filename to write instead
X			of appending, allow %d for article number in name.
X
X			The VNEDITOR variable.
X
X			Statistics collection ability.
X
X			Update of .newsrc "read" number to reflect removed
X			articles, preventing rescanning of group on next
X			session.
X
X			take out SIGHUP catching to avoid problems with
X			message being output.
X
X			key to print version being used.
X
X	Bug fixes following 12/87 posting.  Made this version 1/88 / res1.1
X	to distinguish.
X
X		Digest extraction in reader.c, fix from steve@mahendo.  Thanks
X		to steve@mahendo & greg@mahendo for tracking down digest
X		extraction bugs.  I obviously didn't beat on the feature enough
X		after rearranging things to abstract the server interface.
X		The digest extraction display is a little less informative,
X		the price paid to allow mail & followup.
X
X		SYS V ifdefs - svart.c, independently arrived at by several
X		people - thank you.  At the behest of a couple people I made
X		it spawn a "mkdir" instead of punting by calling mknod.
X
X		Fix bug which would cause vn to crash if article has
X		no "From" / "Reply-to" / "Path" line. - std.c
X
X		Fix bug preventing assignment of .newsrc to filesystem other
X		than that containing user's HOME.
X
X		Fix excessive allocation in hash.c
X
X		Handle duplicate active list records more gracefully.
X
X		term_set(RESTART) call added to recovery from being
X		backgrounded in sig_set.c, in case something you ran while
X		backgrounded messed up your terminal state.  I lost the name
X		of the person reporting the problem & fix - my apologies.
X
X		display optimization in reader.c which repaints instead of
X		scrolling if indicated by user's MORE variable.  This came
X		from Greg Earle, earle@mahendo.  Modified slightly for
X		cosmetic reasons & to fix a small folded-line bug.
X
X	2/88 (bobm)
X
X		Put mode on open() call in temp_open, as per bug fix from
X		Don Craig.  This has been working this way a long time on
X		a lot of systems (the file is unlinked after creation, so
X		the actual mode doesn't really matter, and as long as your
X		open call doesn't check the unused bits a random argument
X		works), but it was wrong, anyway.
X
X	4/88 (bobm)
X
X		Change server interface a bit to allow more control over
X		saving features, and provide a more generalized interface
X		for the vns_ routines to hang interactive hooks from.
X		Allow vns_ layer knowledge of marks.  These changes
X		should allow future implementation of selective lists,
X		use of the interface for a mailer, extra functionality
X		add-on at the vns level, etc.
X
X		incorporate changes to allow 8 bit intl. character set
X		in user strings - came from Marius Olafsson, marius@rhi.
X		Also made 0x7f a #define'ed mask in case you should want
X		to try allowing 8 bit command chars.
X
X		Jay Maynard, splut!jay pointed out that the percentage
X		calculation in reader overflowed for a 327+ line article
X		on a 16 bit machine, and sent fix.
X
X		std.c - fix "all.all" bug (any newsgroup names with
X		multiple "all"'s in them incorrectly converted into RE's
X		which would match practically nothing).  Up vns_Version
X		stamp to 1.2.
X
XKnown bugs:
X
X	If your terminal init string contains a newline, I suspect you will
X	get an initial "stopped on tty output" if you fire up backgrounded.
X	Cooked mode until session is started probably saves us in a lot of
X	cases where the init string contains no newlines.  Can be fixed, but
X	it's esoteric enough that I don't want to add another file to the
X	"patched" list.
X
X	non-erasure of stuff on prompt line when the new
X	string includes an escape sequence (like PS1 maybe)
X	because it doesn't realize that the escape sequence
X	won't overprint the existing stuff
X
X	control-w and update on exit may not update pages which have been
X	scanned in funny orders by jumping into the middle of groups
X
X	inaccurate numbers on '%' command results - reflect ranges, not
X	actual numbers of articles.
X
X	no arrow keys recognized which don't begin with <escape>
X
X	doesn't know about the version 2.11 'm' in active list, or
X	use the 'y' / 'n' either.
X
X	crash due to embedding $\(\) type substring specifiers in regular
X	expressions.  Obscure and hard to fix in a proper and portable way.
X
X	Spool numbers are kept in int, not long - it would take quite
X	a bit of scrubbing through the code to root out this 32-bit'ism.
X	I wish I had typedef'ed the things.
X*/
X#include <stdio.h>
X#include "node.h"
X#include "tty.h"
X#include "brk.h"
X
Xextern int Lrec;
X
Xextern NODE **Newsorder;
Xextern int Ncount;
X
Xextern int Listfirst, Nounsub;
X
Xmain(argc,argv)
Xint argc;
Xchar **argv;
X{
X	/*
X		initialize environment variables,
X		scan .newsrc file, using any command line options present.
X	 */
X	term_set (START);
X	envir_set ();
X	sig_set (BRK_IN);
X
X	stat_start();
X
X	hashinit();
X	temp_open();
X
X	vns_news (argc,argv,&Listfirst,&Nounsub);
X
X	fw_done ();
X
X	make_newsorder();
X
X	tty_set (BACKSTOP);
X
X	if (Lrec >= 0)
X		session ();
X	else
X	{
X		new_groups ();
X		fprintf (stderr,"\nNo News\n");
X	}
X
X#ifndef	MINIX
X	tty_set (COOKED);
X#else
X	tty_set (XCOOKED);
X#endif
X
X	/* exiting, don't worry about FLG_ECHG resetting */
X	vns_write(Newsorder,Ncount);
X
X	term_set (STOP);
X	vns_exit(0);
X
X	stat_end( Lrec >= 0 ? 1 : 0 );
X}
END_OF_FILE
if test 9884 -ne `wc -c <'vn.c'`; then
    echo shar: \"'vn.c'\" unpacked with wrong size!
fi
# end of 'vn.c'
fi
if test -f 'vn.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'vn.h'\"
else
echo shar: Extracting \"'vn.h'\" \(1364 characters\)
sed "s/^X//" >'vn.h' <<'END_OF_FILE'
X/*
X** vn news reader.
X**
X** vn.h - general parameters
X**
X** see copyright disclaimer / history in vn.c source file
X*/
X
X#define TRUE 1
X#define FALSE 0
X
X#define ED_MARK '>'
X#define ART_MARK '*'
X#define ART_WRITTEN '_'
X#define ART_UNWRITTEN ' '
X
X
X#define ANFLINES 1
X#define UDKFORM "undefined key - %c for help"
X#define HELPFORM "%c for help"
X
X/*
X	command characters - don't use numerics or <ESC>
X	ALTSAVE is a hack to avoid having to use ctl-s - XON/XOFF.
X	Wanted to preserve "s" pneumonic and lower / control /cap
X	convention.
X*/
X#define DIGEST 'd'
X#define UP 'k'
X#define DOWN 'j'
X#define FORWARD '\012'
X#define BACK '\010'
X#define GRPFORWARD '>'
X#define GRPBACK '<'
X#define READ 'r'
X#define ALTREAD ' '
X#define READALL 'R'
X#define READSTRING '\022'
X#define SAVE 's'
X#define SAVEALL 'S'
X#define SAVESTRING '\023'
X#define ALTSAVE '\024'
X#define PRINT 'p'
X#define PRINTALL 'P'
X#define PRINTSTRING '\020'
X#define MARK 'x'
X#define UNMARK 'X'
X#define MARKSTRING '\030'
X#define REDRAW '\014'
X#define QUIT 'q'
X#define SSTAT '#'
X#define GRPLIST '%'
X#define ORGGRP 'o'
X#define ORGSTAT 'O'
X#define UPDATE 'w'
X#define UNSUBSCRIBE 'u'
X#define UPALL 'W'
X#define UPSEEN '\027'
X#define UNESC '!'
X#define NEWGROUP 'n'
X#define HEADTOG 'h'
X#define SETROT 'z'
X#define HELP '?'
X#define TOPMOVE 'H'
X#define BOTMOVE 'L'
X#define ALTBOTTOM 'G'
X#define MIDMOVE 'M'
X#define PRTVERSION '"'
X
END_OF_FILE
if test 1364 -ne `wc -c <'vn.h'`; then
    echo shar: \"'vn.h'\" unpacked with wrong size!
fi
# end of 'vn.h'
fi
if test -f 'vn.man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'vn.man'\"
else
echo shar: Extracting \"'vn.man'\" \(24933 characters\)
sed "s/^X//" >'vn.man' <<'END_OF_FILE'
X.TH VN 1 6/1/88
X.UC
X.SH NAME
Xvn - visual news reader
X.SH SYNOPSIS
X.I vn [options]
X.SH DESCRIPTION
X.I Vn
Xis a news reader which uses the same 
X.B .newsrc
Xfile as
X.I readnews
X(1), but displays and interacts differently.  It is aimed at allowing
Xyou to rapidly scan a large number of newsgroups, looking for something
Xyou want to read.  The major premise is that you will be interested in a
Xsmall number of articles, but will be interested in keeping tabs on a large
Xnumber of newsgroups which may contain something interesting from time to time.
XIt also has the ability to unpackage digests.
X.sp
XAs with other readers,
Xoptions may be given on the command line, in which case they will
Xsupersede those given in the
X.B .newsrc
Xfile.
X.SH OPTIONS
X.I Vn
Xsupports the -n, -x and -t options of
X.I readnews
X(specify newsgroup, read all articles, and specify title).
XIn addition, there some other options: -U, -S, -%, -w, -t and some options
Xbeginning with +.  The "+" options are not recognized within the
X.B .newsrc
Xfile, only on the command line, and are intended for use in environments
Xwith multiple NNTP installations.  If you are not using an NNTP version,
Xor only have one news installation accessible from a given machine, they
Xare probably of little use.
X.sp
XThe -w (writer
Xor author) option which works like -t, but is a search string to
Xapply to the "From" header line rather than the subject.  In the -n, -t
Xand -w options, a leading "!" on the string is taken to mean negation.
XThe rest of the string is a regular expression for the -w and -t options.
X.sp
XFor example:
X.sp
X-n net.dogs -w !fred -t [Bb]eagle
X.sp
XSelects articles in net.dogs about beagles written by somebody other
Xthan fred.  Multiple -w -t options are treated as follows:
X.in +5
X.sp
XIf the article satisfies any of the negations, you won't see it,
Xregardless of the non-negated options.
X.sp
XMultiple -w options are logically "or'ed", as are multiple -t's.
X.sp
XIf both -w and -t are present, the article is seen only if it satisfies
Xat least one of the -w's and at least one of the -t's, i.e. the results of the
Xlogical "or's" of the -t's and of the -w's are logically "anded" together.
X.sp
X.in -5
XThe -n options allow the "all" convention, replacing ".all" by
X".*" before using the regular expression calls.  -n options are processed
Xin the order given so that subsequent, more specific, -n's may partially
Xundo the effect of previous "alls".  Note that the -n option
Xtreatment is slightly different than the
X.I readnews
Xtreatment which says that "foo" implies "foo.all".
X.I Vn
Xaccepts this incompatibility to allow you an easier way of saying JUST "foo"
Xwithout any of its subgroups.
X.sp
XThe -S option is useful in conjunction with command line -n options.  It is
Xreally not useful in the
X.B .newsrc
Xfile, but existed before the "+" options were added.
XFor command line -n options, the "!" unsubscriptions in
X.B .newsrc
Xare also ignored.  This allows you to override all subscription information
Xby command line specification.  -S will modify this behavior.
XIf you use an -S option on the command line,
Xthe "!" unsubscriptions will still be used.
X.sp
XThe -% option initially gives you the results of a "%"
Xcommand, rather than the page for the first newsgroup (see below).
XThis allows you to see what newsgroups are available before viewing any.
X.sp
XThe -U option says that when your
X.B .newsrc
Xfile is updated via answering "yes" to the update query on
Xexit or using control-W, newsgroups marked with "!" are to be updated too.
XNormally, these groups are left alone, i.e. updated only to the number that
Xwas already in your
X.B .newsrc,
Xor the lowest article number still around.
XYou may get flooded should you decide to resubscribe.
XIf you don't like this treatment, use -U.  Then, control-W and "yes" to
Xthe update on exit will update your unsubscribed newsgroups to the most
Xrecent article.
X.sp
XThe "+" options mainly deal with NNTP.  If you are not using
Xan NNTP version (will be printed in the version message on startup,
Xversion will either be "res" or "nntp"), the +l, +m and +t options
Xare not recognized.
X.sp
XThe +n option must be followed by a filename, and directly specifies the
X.B .newsrc
Xfile in a manner similar to the NEWSRC variable, which it will override
Xif defined.
X.sp
XThe +m option must be followed by a machine name, and specifies the
Xmachine to talk the news installation on.  This will normally default
Xto some site-determined machine, and may also be set via the VNMACHINE
Xvariable.  The option overrides the variable, if defined.  Note that
Xthis is useful only if you have multiple news INSTALLATIONS accessible
Xfrom your machine, ie. different spooling areas with possibly different
Xsets of articles and different newsgroups based on which machine you
Xcommunicate with to obtain the news.  A majority of sites will not
Xhave this situation, so if you find the explanation confusing, ignore it.
X.sp
XThe +l option makes an NNTP version behave in a non-NNTP fashion, ie.
Xit directly reads the articles and newsgroup information, rather than
Xcommunicating with NNTP.  An empty string for VNMACHINE corresponds to
Xthis.
X.sp
XThe +t option must be followed by a filename, and will cause a trace
Xof the interaction with the NNTP server to be collected into it.
XPrimarily useful for somebody installing the program.
X.SH "USER INTERFACE"
XWhen
X.I vn
Xis invoked,
Xthere will be a pause (with an explanatory "reading" message and
Xa series of newsgroup names) while 
X.I vn
Xreads the news.  The newsgroups listed
Xare ones articles are actually being found in.
XThe length of the pause depends
Xon how much news there is.  If there is a lot,
Xit may take a long time to get through the reading phase.
XIf this is the first time you are using
X.I vn,
Xor if you are starting with an empty 
X.B .newsrc
Xfile,
Xthis may take a 
X.I very
Xlong time;
Xthere is a
X.I lot
Xof news out there.
X.sp
XOnce the reading phase is over, interaction is rapid.
XIf
X.I vn
Xis backgrounded, it suppresses the "reading" output, so
Xthat it will not halt on tty output until it is ready to begin showing
Xarticles.
X.sp
X.I Vn
Xmay show you a list of newsgroups which were not mentioned in the
X.B .newsrc
Xfile.  Records for these newsgroups will be added
Xto your 
X.B .newsrc
Xfile, whether
Xthey were scanned for articles or not.  The first time
X.I vn
Xis used, the list may be quite long and scroll off the screen.
XThereafter, there should only be a list when new newsgroups are
Xcreated.  This display serves to let you know of their existence,
Xor of something happening to your
X.B .newsrc
Xfile.
X.sp
XThe basic display is a "page" which shows a newsgroup and a list of
Xtitles, number of
Xlines, and authors for new articles.
XArticles which have been updated in the
X.B .newsrc
Xfile  are flagged with an underscore preceding the article number.
XYou also have the ability to "mark" articles for the duration of a session;
Xthis is
Xshown with an asterisk.
X(Columns 1 and 2 are reserved for asterisk and
Xunderscore respectively.
XIn normal usage they will be blank, so that the casual user will probably
Xbe unaware of their use until marking and updating are invoked.)
X.sp
XThere is a help menu to go with this page.
XYou may read articles, save them, or send them to the printer, either by cursor
Xposition, the whole page, or in specified sets.  Sets are specified either
Xas a set of article numbers, a regular expression to match the subject /
Xauthor / number of lines data on, or an asterisk to indicate the choice
Xof a set of previously marked articles.  Any of these methods also
Xaccept a leading "!" to indicate negation.
X.sp
XWhen you read articles only a couple of the dozen or so
Xheader lines are
Xshown.  There is an option to allow you to see all the
Xheader lines when you read articles.  The command controlling this toggles
Xbetween the two states.
X.sp
XA similar toggle is used to support ROT13 encryption.
X.sp
X.I Vn
Xis capable of manipulating digests.  The "d" command unpacks a digest
Xand presents you with a page showing the unpacked articles.
XThese can then
Xbe accessed the same way as articles on normal newsgroup pages.
XWhen you leave the digest page(s), you reenter the normal flow of newsgroups.
XDigests can also be read as normal articles, of course.
X.sp
XThe order of page presentation is determined by
Xorder of the group lines in the
X.B .newsrc
Xfile.
XNewsgroups which are not
Xmentioned in
X.B .newsrc
Xwill be added, as mentioned previously, at then end of the file.
XLines corresponding to non-existent newsgroups will be deleted.
XYou will probably want to run
X.I vn
Xonce, then edit your
X.B .newsrc
Xfile
Xto the desired order of presentation.
X.sp
XUpdating the data for
X.B .newsrc
Xis under user control.  If you do
Xno "W", "w", "^w", "o" or "O" commands, no updating takes place,
Xand you'll see the
Xarticles again the next time you read news.
XIf you quit without updating, you will be prompted to make sure you
Xthis is really what you
Xwant to do.
X.sp
XNote that "updating what you've seen" to
X.I vn
Xmeans that you've seen the page presentation, not that you've read the
Xarticle.  This is consistent with the overall assumption that you don't
Xwant to read most of what you are presented with.
X.sp
XBreaks result in a "really quit?" query, so you can recover from noisy
Xlines and prompts for commands you didn't really mean.  If you answer no,
Xyou are simply jumped back to the page.  Breaks while in the midst of scrolling
Xout an article you are reading jump you to the end of the article to stop
Xthe output.
X.sp
XCommands are single character (no return key required), except that
Xthey may be preceded with numeric characters, which may have
Xsome effect on their actions.  Commands which require further input
Xcause prompts for the information, this input being
Xterminated by return.  For prompted input, the erase and kill keys
Xwork.
X.sp
X.ce 1
XCommand Menu For Page:
X.sp
X.nf
X[...] = effect of optional number preceding command
Xpipes are specified by filenames beginning with |
Xarticles specified as a list of numbers, title search string, or
X	* to specify marked articles.  ! may be used to negate any
X
X	 q - quit
X	 k - (or up arrow) move up [number of lines]
X	 j - (or down arrow) move down [number of lines]
X <back sp> - (or left arrow) previous page [number of pages]
X  <return> - (or right arrow) next page [number of pages]
X         > - next newsgroup [number of newsgroups]
X         < - previous newsgroup [number of newsgroups]
X	 d - unpack digest
X	 H - top of page
X	 L - bottom of page
X	 G - bottom of page (alternate L)
X	 M - middle of page
X	 d - unpack digest
X	 r - read article [number of articles]
X   <space> - read article (alternate 'r')
X	 R - read all articles on page
X control-r - specify articles to read
X	 s - save or pipe article [number of articles]
X	 S - save or pipe all articles on page
X control-s - specify articles to save
X control-t - specify articles to save (alternate ctl-s)
X	 p - print article [number of articles]
X	 P - print all article on page
X control-p - specify articles to print
X	 w - update .newsrc status to cursor
X	 W - update .newsrc status for whole newsgroup
X control-w - update .newsrc status for all pages displayed
X	 o - recover original .newsrc status for newsgroup
X	 O - recover all original .newsrc status
X	 # - display count of groups and pages - shown and total
X	 % - list newsgroups with new article, updated counts
X	 n - specify newsgroup to display and/or resubscribe to
X	 u - unsubscribe from group
X	 x - mark/unmark article [number of articles]
X	 * - mark/unmark article [number of articles]
X	 X - erase marks on articles
X control-x - specify articles to mark
X	 h - toggle flag for display of headers when reading
X	 z - toggle ROT13 mode for reading
X<formfeed> - redraw screen
X	 ! - escape to UNIX to execute a command
X	 " - show vn version
X	 ? - show this help menu
X.fi
X.sp
XWhen you read articles there is another help menu for advancing through
Xthe articles, replying, posting followups, and saving the
Xarticles.  Breaks may be used to
Xstop the output of an article if you decide that you didn't really
Xwant to read it.  You can jump from the reading portion back to either
Xpage you came from or the NEXT page.
X.sp
XFor replying and posting followups, you will be placed in an editor
Xto create the reply or article.
XThe article will be included in the file you are editing, marked with
X"> "'s for excerpting in your reply or followup.  After exiting the
Xeditor you are prompted to make sure you still want to post or reply.
X.sp
XFor followups, your article is appended to "author_copy" for future
Xreference.
X(See CCFILE in the section on ENVIRONMENT VARIABLES).
X.sp
XHeader lines for the mailer / news poster are present in the file
Xyou are editing to allow you to modify them.  Remember to leave a blank
Xline between the header lines and your text.  It may be OK if you
Xdon't, but why tempt fate.
X.sp
XThe editor is determined by your EDITOR or VNEDITOR variable, as for
X.I postnews.
X(See the section on ENVIRONMENT VARIABLES).
XIf EDITOR is not set, you get
X.I vi.
X.sp
X.ce 1
XReading menu:
X.sp
X.nf
X         n - next article, if any
X         q - quit reading articles, if any more to read
X         Q - quit reading, and turn to next page of articles
X         r - rewind article to beginning
X  <return> - next line
X         / - search for a pattern in the article
X         m - send mail to author of article
X         f - post followup to article
X         s - save article in a file
X         p - send article to the printer
X         ? - see this help menu
X         z - toggle rotation flag
X         h - toggle header suppression flag
X
X anything else to continue normal reading
X.fi
X.sp
XWhen articles are saved from anywhere, a few special conventions apply.
X.sp
XIf the name begins with "|", you are specifying
Xa pipe to feed the article(s) to, rather than a file.  No other interpretation
Xis done in this case.
X.sp
XIf you specify a name not beginning with "/", the article will be saved
Xwith reference to your original directory, or with reference to the VNSAVE
Xvariable (see below).
X.sp
XIf you embed a "%d" in the name, that
Xwill be replaced with the article number, or the first number in a list
Xof articles.
X.sp
XIf you prepend "w:" to the
Xname, you can force an overwrite instead of an append.  The colon prefix
Xmay be used to open the file with any mode you please, actually.  If you
Xreally WANT a colon in the name, specify "a:" ahead of it.  The colon
Xprefix is stripped off before any other filename interpretation.
X.sp
XBoth the VNSAVE variable and the save name may use a leading "~" to
Xindicate the user's home or "~name" for another user's home.  It is assumed
Xthat a slash will separate the tilde expression from the rest of VNSAVE, or
Xthe rest of the file name if there are further directories.
X.sp
XWhen you are prompted for a savefile name, the last non-pipe
Xname you used
Xis presented, so you may use your erase/kill keys to edit it.
X.sp
XOld search strings / pattern match strings are also presented for edit in the
Xsame manner.
X.sp
XIf you don't like the choice of command keys, you
Xmay change them (default choices - basic control in article
Xreader is ala 
X.I more
Xof course, the "j" and "k" on the page presentation are 
X.I vi
Xconvention, other page commands are somewhat 
X.I readnews
Xcompatible).
XIf you have a file named
X.B .vnkey
Xin your home directory this file will be read in order to obtain keystroke
Xtranslation.  The format is simple:
X.sp
XEach line begins with R or P indicating translation for the reader interaction,
Xor the page interaction (r and p accepted also).  Following the R or P is
Xa character, followed by an "=", followed by another character.  The character
Xon the left hand side of the equals sign is what you wish to input, and the
Xcharacter on the right hand side of the equals sign is what you wish to
Xtranslate it to.  No embedded spaces are allowed.
XLines not beginning with the proper characters are simply
Xignored, as are characters following the translated character.  Eg:
X.sp
X.in +5
XPd=j
X.br
XPu=k
X.in -5
X.sp
Xuses "u" and "d" instead of "j" and "k" on the page layout (presumably,
Xyou are also going to translate something else to "u" and "d" for the
Xunsubscribe and digest commands).  If you translate keys, it is up to you
Xto see that all commands can still be reached, and that former command keys
Xwhich are no longer used are mapped to something meaningless.  In particular,
Xyou are going to have difficulties if you make it impossible to input "q".  The
Xhelp menus will show the "new" keys, and bad mappings should show up as
Xmultiple definitions for the same key, or alternate mappings not showing
Xup on the help menu.
X.sp
XMapping the "=" key via "==" works.  Any keys not mentioned in the file
Xare translated to themselves.
X.sp
XControl keys are given as DECIMAL numbers with no backslashes or anything.
XThe decimal number is the ASCII code for the character, eg:
X.sp
X.in +5
XP24=12
X.br
XP12=?
X.in -5
Xuses "control-x" for the "control-l (formfeed)" refresh key, and maps the
Xcontrol-l to a "?".  BTW, mapping all undefined keys to "?" will mean that you
Xautomatically get the help display for any illegal key, should you wish for
Xsuch a thing.  The LAST one mapped will determine what key is given in
Xthe "? for help" lines, and the help display itself.
XRemembering that control-A through
Xcontrol-Z are ASCII codes 1 through 26 and delete = 127 may keep you from
Xhaving to consult an ASCII table.  Remember also that some controls, such
Xas control- C, Z, S or Q may be caught by the operating system for signal
Xgeneration or terminal control, and are thus unavailable.
X.sp
XBecause of arrow keys and the ability to prefix commands with counts,
Xnumeric characters and the escape key may not be used for page commands.
XAttempts to use them will simply do nothing.
X.sp
XControl keys are not available for the reader, except for newline,
Xbackspace, and tab.  The reason controls are filtered here has to do
Xwith nasty problems involving terminal mode switches on some systems,
Xspecifically a UTS frontend early versions were being used on.
X.sp
XIn either interaction, "return" and "linefeed" are mapped to the "newline"
Xcharacter at a level below the translation.  If you don't know the
XASCII for the "newline" char, it is recommended that you map both
XASCII 10 and 13 if you wish to map "return" to something.
X.SH FILES
X.TP 24
X/usr/tmp/*
XOne temporary file created by
X.I tmpnam
X(3), and immediately unlinked,
Xremains open in update mode for duration of session.
XDisk space freed by system close of file descriptor at exit.
XCan be large, as this file contains the "page" displays.
XTemporary files also created by
X.I tmpnam
X(3) for mailing replies, posting followups and creating digest "articles".
X.TP 24
X(login directory)/.newsrc
Xnews status file.  Updated following session.  See NEWSRC environment variable.
X.TP 24
X(login directory)/author_copy
XA copy of all articles posted using the followup command will be appended
Xto this file in /bin/mail format.  See CCFILE environment variable.
X.TP 24
X(login directory)/.vnkey
XKeystroke mapping file for changing command characters.
X.TP 24
X(login directory)/*.vnXXXXXX
XOne temporary file created by
X.I tmpnam
X(3) while updating the 
X.B .newsrc
Xfile.  If the update fails, you are informed,
Xand this file
Xmay be used to recover the last update.  Unlinked following successful update.
X.TP 24
X(spool directory)/*
Xspooling directories containing articles.
X.TP 24
X/usr/lib/news/active
Xactive newsgroup list.
X.SH "ENVIRONMENT VARIABLES"
XFor all variables which do not begin with "VN", 
X.I vn
Xwill accept an override
Xby setting a variable VN<name> which will be preferred.  For instance
Xsetting VNEDITOR allows you to use a special editor for 
X.I vn
Xwithout affecting
Xuse of that variable by your shell, setting VNPS1 takes care of your
Xnormal UNIX prompt having multiple lines, or setting VNNEWSRC allows you to
Xuse 
X.I vn
Xwithout disturbing your 
X.B .newsrc
Xfor other readers.
X.TP 24
XVNSAVE
XUsed as a directory to place saved articles in.  If it does not begin
Xwith "/", it will be taken with respect to the users home directory.  If
Xit ends with "/%s", a separate directory will be created for each
Xnewsgroup.
X.TP 24
XPS1
XUsed to present prompt string for command on unix escape.
XDefaults to "$ "
X.TP 24
XEDITOR
XEditor used for mailing replies and posting followups.
XDefaults to 
X.I vi.
X.TP 24
XPOSTER
XPosting program for followups.  Defaults to "inews -h".
X.TP 24
XMAILER
XUsed when mailing replies.  Defaults to "sendmail -t".
X.TP 24
XPRINTER
XProgram used with the print commands for sending articles to
Xthe printer.  Defaults to "lpr".
X.TP 24
XNEWSRC
XIf set, can be used to override the choice of 
X.B .newsrc
Xas the
Xname for the status file.  Name will still be used relative to
Xthe login directory, unless it begins with "/".
X.TP 24
XCCFILE
XIf set, overrides the choice of "author_copy" as the name of the
Xfile to CC all articles posted with the followup command.  Name
Xwill still be used relative to the login directory, unless it begins
Xwith "/".
X.TP 24
XVNKEY
XIf set, overrides the choice of ".vnkey" as the name of the
Xfile to map keys from.  Name
Xwill still be used relative to the login directory, unless it begins
Xwith "/".
X.TP 24
XVNMACHINE
XApplies only to NNTP versions - sets the machine to talk to.  See discussion
Xof options, above.
X.SH DIAGNOSTICS
XUser error messages.  Self explanatory.
X.SH AUTHOR
XBob McQueer.
X.sp
XSignificant enhancement / bugfixes / suggestions from:
X.sp
XLawrie Brown, John G Dobnick, Greg Earle, Rodney Goke, Andy Marrinson,
XJay Maynard, Marius Olafsson, George Pavel, Dave Tallman, Larry Tepper,
XKarl Williamson, Mark Wittenberg, Andrew Worsley
X.sp
XAnd undoubtedly some others who have been forgotten.  My apologies.
X.SH BUGS
XNote that
X.I readnews
Xwill rearrange the order of
X.B .newsrc.
XIf you
Xinterleave use of it with
X.I vn,
Xorder selection gets hosed.
X.sp
XIf you've really taken advantage of the ability of 
X.I readnews
Xto skip
Xarticles in the middle of the spooling numbers, be warned that
X.I vn
Xdoesn't have it, and will
Xassume you've read the articles in the middle.
X.sp
XIf the
X.B .newsrc
Xfile indicates that you've read articles in a newsgroup with a higher
Xnumber than the current spooling number for that newsgroup,
X.I vn
Xwill show you up to 60 old articles.  This is intended for recovery in
Xcases where article spooling has been reset, or to avoid missing articles
Xbecause you just changed machines and didn't bother to edit your
X.B .newsrc
Xfile.  Rather than miss stuff, you'll see some old stuff again.  During
Xthe reading phase, a warning message is printed that this is happening.
X.sp
XSometimes a "break" during reading an article will not only halt the
Xarticle but suppress the prompt.  A command character will work anyway.
X.sp
XIf a prompt to be displayed on the dialogue line
Xcontains non-printing sequences, stuff on the
Xline may not get erased when you are prompted, because
X.I vn
Xthinks the string is long enough to overprint its current contents.
XThis usually comes up when you have escape sequences in your UNIX
Xprompt, and do a "!" command.
XThe "overprint" check is made to save a clear-line sequence (kludged in
Xby overprinting to the end with blanks if the terminal doesn't
Xhave one - annoying at 1200 baud).
X.sp
XOutput during the reading phase which was suppressed by backgrounding
X.I vn
Xdoes not get started by foregrounding it again without doing a
Xcontrol-z and a second foreground (it doesn't figure out its background /
Xforeground status on each output - only on startup and while handling
Xthe SIGTSTP signal).  Actually, this results in a method for having
X.I vn
Xdo its reading phase silently in the foreground without redirecting
Xoutput, should such a thing be desired.
X.sp
XVery many -w or -t options cause SLOW reading phases.  It is recommended
Xthat these be used only when reading a few specific groups.
X.sp
XDigest extraction will split a single article into several if it contains
Xembedded ---- lines, the normal separator between articles in digests.
XThey will all have identical titles.
XDigest extraction may not work with human built digests which don't
Xuse the expected syntax for joining articles.  Mod.computers.ibm-pc
Xand mod.computers.mac were used as models for the feature.
X.sp
XThe data given by the % command represents the difference between the
Xlast article number you've updated to in a newsgroup and the high
Xarticle number.  This may be significantly greater than the number of
Xactual articles for a newsgroup you haven't been reading, and for
Xnewsgroups that have had a lot of articles filtered out of them using
Xthe -w and -t options.  The numbers given for menu selection in the
X % command are the order numbers from the 
X .B .newsrc,
Xand have gaps for
Xunsubscribed newsgroups.
X.sp
XThe key mapping capability doesn't handle function keys.  Because of the
Xuse of controls as commands, terminals whose arrow keys echo something
Xother than a sequence beginning with escape can't use arrow keys.  For
Xthese terminals, a warning message is printed during the reading phase.
END_OF_FILE
if test 24933 -ne `wc -c <'vn.man'`; then
    echo shar: \"'vn.man'\" unpacked with wrong size!
fi
# end of 'vn.man'
fi
if test -f 'vnglob.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'vnglob.c'\"
else
echo shar: Extracting \"'vnglob.c'\" \(1600 characters\)
sed "s/^X//" >'vnglob.c' <<'END_OF_FILE'
X/*
X** vn news reader.
X**
X** vnglob.c - global variables - see string.c also
X**
X** see copyright disclaimer / history in vn.c source file
X*/
X
X#include <stdio.h>
X#include "config.h"
X#include "head.h"
X#include "tune.h"
X#include "node.h"
X#include "page.h"
X
X/*
X	global data structure
X*/
XNODE **Newsorder = NULL;	/* in order of fw_group calls */
X
Xchar *Editor, *Ps1, *Printer;
X
Xint (*Massage)() = NULL;
Xint (*Postfunc)() = NULL;
Xint (*Mailfunc)() = NULL;
Xchar (*Marker)() = NULL;
Xint (*Hookfunc)() = NULL;
Xchar *(*Hookhelp)() = NULL;
XFILE *(*Saveopen)() = NULL;
Xint (*Digsaver)() = NULL;
X
Xchar Erasekey, Killkey;		/* user keys from stty */
Xchar *Orgdir;			/* .newsrc file, and original pwd */
Xchar *Savefile = DEF_SAVE;	/* file in which to save articles */
Xchar *Savedir;			/* default directory for saved articles */
Xchar *Ccfile;			/* author_copy file, stored /bin/mail fmt */
Xchar *Home;			/* user's home */
X
Xint Rot;	/* rotation */
Xint Headflag;	/* header printing flag */
Xint Digest;	/* if non-zero, digest article */
Xint More;	/* if non-zero, clear screen between each page.  Set by */
X		/* user's MORE environment variable; if `-c', then set true */
X
Xchar *Ku, *Kd, *Kl, *Kr;	/* Cursor movement capabilities */
X
X/* character translation arrays for commands */
Xchar Cxitop[CHMASK+1], Cxitor[CHMASK+1], Cxrtoi[CHMASK+1], Cxptoi[CHMASK+1];
X
X/*
X	cur_page - current page displayed;
X	lrec - last record
X	l_allow - lines allowed for article display
X	c_allow - columns allowed
X	ncount = newsorder index
X*/
Xint Cur_page, Lrec, L_allow, C_allow, Ncount;
X
Xint Nounsub, Listfirst;
X/*
X	current page
X*/
XPAGE Page;
END_OF_FILE
if test 1600 -ne `wc -c <'vnglob.c'`; then
    echo shar: \"'vnglob.c'\" unpacked with wrong size!
fi
# end of 'vnglob.c'
fi
echo shar: End of shell archive.
exit 0
-- 
			"Zeta Microcomputer Software"
ACSnet:    nick@nswitgould.cs.uts.oz	nick@ultima.cs.uts.oz
UUCP:      ...!uunet!munnari!ultima.cs.uts.oz!nick
Fidonet:   Nick Andrew on 3:713/602 (Zeta)