[comp.os.minix] Vn diffs for Minix, part 1/2

nick@ultima.cs.uts.oz (Nick Andrew) (07/13/89)

echo x - MANIFEST
sed '/^X/s///' > MANIFEST << '/'
Xtotal 35
X-rw-r--r--  1   root     1136 Jul 13 21:17 MANIFEST
X-rw-r--r--  1   root     2447 Jul 13 21:12 config.h.d
X-rw-r--r--  1   root     1269 Jul 13 21:12 config_std.h.d
X-rw-r--r--  1   root     1157 Jul 13 21:12 digest.c.d
X-rw-r--r--  1   root      457 Jul 13 21:12 envir_set.c.d
X-rw-r--r--  1   root     1437 Jul 13 21:12 getch.c.d
X-rw-r--r--  1   root      918 Jul 13 21:12 help.c.d
X-rw-r--r--  1   root     4374 Jul 13 21:09 makefile
X-rw-r--r--  1   root     1064 Jul 13 21:12 pagefile.c.d
X-rw-r--r--  1   root      565 Jul 13 21:12 printex.c.d
X-rw-r--r--  1   root     1448 Jul 13 21:13 reader.c.d
X-rw-r--r--  1   root     1093 Jul 13 21:10 regcompat.c
X-rw-r--r--  1   root     1695 Jul 13 21:13 session.c.d
X-rw-r--r--  1   root      441 Jul 13 21:13 sig_set.c.d
X-rw-r--r--  1   root      480 Jul 13 21:13 stat.c.d
X-rw-r--r--  1   root      680 Jul 13 21:13 std.c.d
X-rw-r--r--  1   root      454 Jul 13 21:13 tty.h.d
X-rw-r--r--  1   root      985 Jul 13 21:13 tty_set.c.d
X-rw-r--r--  1   root      584 Jul 13 21:13 userlist.c.d
X-rw-r--r--  1   root      494 Jul 13 21:13 vn.c.d
X-rw-r--r--  1   root      604 Jul 13 21:13 vn.h.d
/
echo x - README
sed '/^X/s///' > README << '/'
X	Here are diffs to Vn to make it run under Minix. The base version
Xof Vn used was the 1/88 version + 4/88 modifications (both posted in
Xcomp.sources.unix). This version should run on a bog-standard Minix 1.3c
Xor 1.4a. Mine isn't quite bog standard, so your mileage may vary :-)
X
XYou may be wondering why have Vn for Minix? After all, it doesn't even
Xhave News yet.  This project is top-down. I'm now working on porting
XNews - it partially works already, but needs more changes yet. With the
Xrecent postings of binmail and UUPC, I thought a Vn posting was appropriate.
X
XThe diffs are posted in 3 parts; this is part 0, you need the other two
Xparts, unshar them, and run the resulting files through patch.  If there
Xis demand from the net, I will post full sources (approx 170k).
X
XChanges involved fixing #includes, shortening some long function names,
Xworking around a couple of compiler and/or preprocessor bugs, customising
Xuser options for Minix, massaging incompatible regexp to make a square peg
Xfit in a round hole, nicening the display, fixing a REAL BUG in Vn, and
Xother miscellaneous things where Minix is braindead (e.g. 3 argument open).
X
X	Shar and enjoy ...
X
XIf mail to nick@nswitgould.oz fails, try nick@ultima.cs.uts.oz ...
X
/
echo x - config.h.d
sed '/^X/s///' > config.h.d << '/'
X*** Orig/config.h	Sat Jul  1 22:01:48 1989
X--- Minix/config.h	Thu Jul 13 20:31:11 1989
X***************
X*** 6,16 ****
X  ** see copyright disclaimer / history in vn.c source file
X  */
X  
X! #define DEF_ED "/usr/ucb/vi"	/* editor to use if no EDITOR variable */
X  #define DEF_PS1 "$ "		/* ! command prompt if no PS1 */
X  #define DEF_SAVE ""		/* save file */
X  
X! #define DEF_PRINT "/usr/ucb/lpr"		/* print command */
X  
X  #define DEF_CCFILE "author_copy"
X  #define DEF_KEYXLN ".vnkey"
X--- 6,16 ----
X  ** see copyright disclaimer / history in vn.c source file
X  */
X  
X! #define DEF_ED "/bin/mined"	/* editor to use if no EDITOR variable */
X  #define DEF_PS1 "$ "		/* ! command prompt if no PS1 */
X  #define DEF_SAVE ""		/* save file */
X  
X! #define DEF_PRINT "/usr/bin/lpr"		/* print command */
X  
X  #define DEF_CCFILE "author_copy"
X  #define DEF_KEYXLN ".vnkey"
X***************
X*** 21,27 ****
X  ** Set to "" if you don't like it answering "yes" for you, or "y"
X  ** if you only want to have to erase one character to say "no", etc.
X  */
X! #define QUIT_ANSWER "yes"
X  
X  /*
X  ** default terminal assumed if TERM variable is unset.  Since TERM has to
X--- 21,27 ----
X  ** Set to "" if you don't like it answering "yes" for you, or "y"
X  ** if you only want to have to erase one character to say "no", etc.
X  */
X! #define QUIT_ANSWER ""
X  
X  /*
X  ** default terminal assumed if TERM variable is unset.  Since TERM has to
X***************
X*** 29,35 ****
X  ** which will cause failure, unless EVERYBODY has the same kind of terminal
X  ** or you don't really use a standard UNIX environment.
X  */
X! #define DEF_TERM "<unspecified TERM variable>"
X  
X  /*
X  ** foreground flag for messages.  applies only if JOBCONTROL undefined
X--- 29,35 ----
X  ** which will cause failure, unless EVERYBODY has the same kind of terminal
X  ** or you don't really use a standard UNIX environment.
X  */
X! #define DEF_TERM "minix"
X  
X  /*
X  ** foreground flag for messages.  applies only if JOBCONTROL undefined
X***************
X*** 104,109 ****
X  ** and avoiding calls to system functions like ctime() and time() which may
X  ** have system dependent quirks.
X  **
X! #define VNLOGFILE "/usr/rti/fe/bobm/vn.log"
X! #define VNSTATFILE "/usr/rti/fe/bobm/vn.stat"
X! */
X--- 104,109 ----
X  ** and avoiding calls to system functions like ctime() and time() which may
X  ** have system dependent quirks.
X  **
X! */
X! #define VNLOGFILE "/usr/tmp/vn.log"
X! #define VNSTATFILE "/usr/tmp/vn.stat"
/
echo x - config_std.h.d
sed '/^X/s///' > config_std.h.d << '/'
X*** Orig/config_std.h	Sat Jul  1 20:11:58 1989
X--- Minix/config_std.h	Thu Jul 13 20:31:11 1989
X***************
X*** 23,29 ****
X  ** of the address lines to choose from, or to input a new one.  MAILCHOOSE
X  ** makes MAILSMART irrelevant, but the two are independent of INLETTER.
X  **
X- #define MAILCHOOSE
X  */
X  #define MAILSMART
X  #define INLETTER
X--- 23,28 ----
X***************
X*** 38,44 ****
X  #else
X  #define DEF_MAIL "/bin/mail"
X  #endif
X! ** OLDRC defined for an apparently earlier news version which took unnamed
X  ** command line options as synonyms for -n, and did not take ranges in
X  ** the .newsrc file.  Probably useless, but kept in for historical reasons.
X  **
X--- 37,44 ----
X  #else
X  #define DEF_MAIL "/bin/mail"
X  #endif
X! 
X! /* OLDRC defined for an apparently earlier news version which took unnamed
X  ** command line options as synonyms for -n, and did not take ranges in
X  ** the .newsrc file.  Probably useless, but kept in for historical reasons.
X  **
X***************
X*** 58,64 ****
X  /*
X  ** maximum number of option lines in .newsrc
X  */
X! #define OPTLINES 60
X  
X  /*
X  ** maximum number of filter options
X--- 58,64 ----
X  /*
X  ** maximum number of option lines in .newsrc
X  */
X! #define OPTLINES 20
X  
X  /*
X  ** maximum number of filter options
/
echo x - digest.c.d
sed '/^X/s///' > digest.c.d << '/'
X*** Orig/digest.c	Sat Jul  1 20:13:27 1989
X--- Minix/digest.c	Thu Jul 13 20:31:12 1989
X***************
X*** 33,39 ****
X  #define FHDLEN 6
X  #define DHDLEN 6
X  
X! digest_page (idx,skip)
X  int idx;
X  {
X  	char name[24];
X--- 33,39 ----
X  #define FHDLEN 6
X  #define DHDLEN 6
X  
X! dige_page (idx,skip)
X  int idx;
X  {
X  	char name[24];
X***************
X*** 81,87 ****
X  /*
X  	returns name of file containing "article", NULL for failure
X  */
X! char * digest_extract (s,art,hdr,start)
X  char *s;
X  int art;
X  ARTHEADER *hdr;
X--- 81,87 ----
X  /*
X  	returns name of file containing "article", NULL for failure
X  */
X! char * dige_extract (s,art,hdr,start)
X  char *s;
X  int art;
X  ARTHEADER *hdr;
X***************
X*** 199,205 ****
X  	for (ptr = strtok(tmp," "); ptr != NULL; ptr = strtok(NULL," "))
X  	{
X  		i = atoi(ptr);
X! 		if ((new = digest_extract(ns,i,&hdr,&pos)) != NULL)
X  		{
X  			sprintf (out,"%s ",new);
X  			out += strlen(new) + 1;
X--- 199,205 ----
X  	for (ptr = strtok(tmp," "); ptr != NULL; ptr = strtok(NULL," "))
X  	{
X  		i = atoi(ptr);
X! 		if ((new = dige_extract(ns,i,&hdr,&pos)) != NULL)
X  		{
X  			sprintf (out,"%s ",new);
X  			out += strlen(new) + 1;
/
echo x - envir_set.c.d
sed '/^X/s///' > envir_set.c.d << '/'
X*** Orig/envir_set.c	Sat Jul  1 22:01:49 1989
X--- Minix/envir_set.c	Thu Jul 13 20:31:13 1989
X***************
X*** 9,15 ****
X  
X  #include <stdio.h>
X  #include <pwd.h>
X! #include <sys/param.h>
X  #include "tune.h"
X  #include "config.h"
X  #include "vn.h"
X--- 9,20 ----
X  
X  #include <stdio.h>
X  #include <pwd.h>
X! 
X! #ifndef MINIX
X! /* minix does not have this */
X! #include <sys/param.h>
X! #endif
X! 
X  #include "tune.h"
X  #include "config.h"
X  #include "vn.h"
/
echo x - getch.c.d
sed '/^X/s///' > getch.c.d << '/'
X*** Orig/getch.c	Sat Jul  1 22:01:54 1989
X--- Minix/getch.c	Thu Jul 13 20:31:13 1989
X***************
X*** 27,34 ****
X  	int i, j;
X  	static char	ckseq[32];
X  
X! 	/* Check for leading count */
X!  	for (i = 0; isdigit(*c = getchar() & CHMASK); i = i * 10 + *c - '0')
X  		;
X  
X  	/* @#$!!! flakey front ends that won't map newlines in raw mode */
X--- 27,38 ----
X  	int i, j;
X  	static char	ckseq[32];
X  
X! #ifdef	MINIX
X! 	fflush(stdout);
X! #endif
X! 
X! 	/* Check for leading count */
X! 	for (i = 0; isdigit(*c = getc(stdin) & CHMASK); i = i * 10 + *c - '0')
X  		;
X  
X  	/* @#$!!! flakey front ends that won't map newlines in raw mode */
X***************
X*** 55,61 ****
X  			if( strcmp(ckseq, Kl) == 0 ) { *c = UP; break; }
X  			if( strcmp(ckseq, Kr) == 0 ) { *c = DOWN; break; }
X  #endif
X! 			*c = (getchar() & CHMASK);
X  			ckseq[++j] = *c; ckseq[j+1] = '\0';
X  		}
X  	}
X--- 59,65 ----
X  			if( strcmp(ckseq, Kl) == 0 ) { *c = UP; break; }
X  			if( strcmp(ckseq, Kr) == 0 ) { *c = DOWN; break; }
X  #endif
X! 			*c = (getc(stdin) & CHMASK);
X  			ckseq[++j] = *c; ckseq[j+1] = '\0';
X  		}
X  	}
X***************
X*** 74,80 ****
X  getnoctl ()
X  {
X  	char c;
X!  	while (iscntrl(c = getchar() & CHMASK))
X  	{
X  		if (c == '\015' || c == '\012')
X  			c = '\n';
X--- 78,88 ----
X  getnoctl ()
X  {
X  	char c;
X! 
X! #ifdef	MINIX
X! 	fflush(stdout);
X! #endif
X! 	while (iscntrl(c = getc(stdin) & CHMASK))
X  	{
X  		if (c == '\015' || c == '\012')
X  			c = '\n';
/
echo x - help.c.d
sed '/^X/s///' > help.c.d << '/'
X*** Orig/help.c	Sat Jul  1 22:01:56 1989
X--- Minix/help.c	Thu Jul 13 20:31:15 1989
X***************
X*** 87,92 ****
X--- 87,94 ----
X  
X  #define HTSIZE (sizeof(Helptab)/sizeof(struct HELPTAB))
X  
X+ 
X+ #define HHLINES 5	/* lines (CRs + 1) contained in HELP_HEAD */
X  /*
X  	help from main screen
X  */
X***************
X*** 98,104 ****
X  
X  	term_set (ERASE);
X  	lim = L_allow + RECBIAS - 2;
X! 	printf("%s\n",HELP_HEAD);
X  	lcount = HHLINES;
X  	for (i=0; i < HTSIZE; ++i)
X  	{
X--- 100,109 ----
X  
X  	term_set (ERASE);
X  	lim = L_allow + RECBIAS - 2;
X! 	printf("%s\n","[...] = effect of optional number preceding command\n");
X! 	printf("%s\n","pipes are specified by filenames beginning with |\n");
X! 	printf("%s\n","articles specified as a list of numbers, title search string, or\n");
X! 	printf("%s\n","	* to specify marked articles.  ! may be used to negate any\n");
X  	lcount = HHLINES;
X  	for (i=0; i < HTSIZE; ++i)
X  	{
/
echo x - makefile
sed '/^X/s///' > makefile << '/'
X# CFLAGS:
X#	set -DJOBCONTROL if you have job control (BSD).
X#	set -DSYSV -Dindex=strchr -Drindex=strrchr on Sytem V systems
X#	set -Dregfree=free if you DON'T include reg.s (SYSV + some BSD)
X#
X# JOBCONTROL could be done as #ifndef SYSV, I suppose, but this clearly
X# marks that particular difference.
X#
X# LIBS:
X# should point to any extra libraries needed, such as termcap.  You
X# may want to change this to use the curses termcap cover.  If you need
X# to pull in another library to get regex / regcmp or strtok on non-SYSV
X# systems, you may want to put that here
X#
X# EXTRAOBJS:
X# may be used to include tmpnam.s, strtok.s, reg.s in the list.
X#
X# These objects implement SYSV utilities for BSD machines.
X#
X# strtok.s implements strtok() / strpbrk().  reg.s implements regex()/regcmp()
X# on top of the BSD regular expression library (regex() allows multiple
X# regular expressions).  tmpnam.s implements tmpnam() of course.
X#
X# If you have them, use your own regex/regcmp, because:
X#
X#	i) They should be faster than the reg.c code, which
X#	recompiles the "current" ucb string every time you
X#	switch regular expressions.
X#
X#	ii) I briefly checked out reg.c once, and it seemed to
X#	work.  Our system has the "real" calls available, so I
X#	run with those.  reg.c hasn't been used much by me, although
X#	I've had nobody tell me it doesn't work.
X#
X# if you DON'T include reg.s, be sure you set -Dregfree=free in CFLAGS.
X#
X# As with regex, if you have a system strtok(), it is likely more efficient -
X# string routines will often be done in assembler on a given machine.
X#
X# Even if you have it, you can use tmpnam.s anyhow.  This version will tailor
X# the temp file name to vnXXXXXX, instead of a generic tmpXXXXXX.
X#
X# "vanilla" BSD:
X#LIBS = -ltermcap
X#EXTRAOBJS = tmpnam.s strtok.s reg.s
X#CFLAGS = -O -DJOBCONTROL
X#
X# "vanilla" SYSV:
X#LIBS = -ltermcap
X#EXTRAOBJS = tmpnam.s
X#CFLAGS = -O -DSYSV -Dregfree=free -Dindex=strchr -Drindex=strrchr
X#
X# BSD with strtok() / regex(), such as ULTRIX.  These are the rules
X# used for our installation (rtech is a microvax running ULTRIX):
X#LIBS = -ltermcap
X#EXTRAOBJS = tmpnam.s
X#CFLAGS = -O -DJOBCONTROL -Dregfree=free
X
X#
X# Minix!!!
X#	Regular expressions: Use reg.c to turn regcmp into re_comp
X#	and regex into re_exec. Use regcompat.c to turn re_comp into
X#	regcomp and re_exec into regexec. Wow! What a load of old
X#	cobblers.
XLIBS =
X#EXTRAOBJS = tmpnam.s strtok.s reg.s
XEXTRAOBJS = tmpnam.s reg.s regcompat.s
XCFLAGS = -O -DMINIX -DSYSV
X
X# SERVEROBJS defines the object(s) for the vns_xxxx "server" interface.
X#
X#	std.s is the version for "standard" news, making use of the
X#	users .newsrc file, and  resident articles / active file.
X#
XSERVEROBJS = std.s
X
X# normal vn objects
X#
XVNOBJS=	hash.s envir_set.s pagefile.s reader.s storage.s sig_set.s \
Xterm_set.s tty_set.s userlist.s vn.s vnglob.s digest.s strings.s \
Xsession.s printex.s getch.s help.s newdisp.s stat.s svart.s
X
X# This is to force you to read the makefile.  Once you have, comment this rule,
X# and uncomment the "real" rule.  At the minimum, you will also have to
X# uncomment one of the three sets of LIBS / EXTRAOBJS & CFLAGS definitions
X# above.
X#
X#vn:
X#	@echo "PLEASE READ THE MAKEFILE"
Xvn:	$(VNOBJS) $(EXTRAOBJS) $(SERVEROBJS)
X	cc -i -o vn $(VNOBJS) $(EXTRAOBJS) $(SERVEROBJS) $(LIBS)
X
Xdigest.s:	digest.c config.h head.h node.h page.h tune.h
Xenvir_set.s:	envir_set.c config.h tune.h vn.h
Xgetch.s:	getch.c config.h vn.h
Xhash.s:		hash.c config.h node.h tune.h
Xhelp.s:		help.c config.h node.h page.h reader.h tty.h tune.h vn.h
Xnewdisp.s:	newdisp.c config.h node.h tty.h
Xpagefile.s:	pagefile.c node.h page.h tune.h
Xprintex.s:	printex.c config.h tty.h
Xreader.s:	reader.c config.h brk.h head.h node.h page.h reader.h  \
X		tty.h tune.h vn.h
Xregcompat.s:	regcompat.c
Xsession.s:	session.c config.h brk.h head.h node.h page.h tty.h tune.h \
X		vn.h
Xsig_set.s:	sig_set.c config.h node.h page.h tty.h tune.h
Xstat.s:		stat.c config.h node.h
Xstd.s:		std.c config_std.h brk.h head.h server.h std.h
Xstorage.s:	storage.c node.h page.h tune.h
Xstrings.s:	strings.c node.h page.h tune.h
Xsvart.s:	svart.c config.h node.h page.h tty.h tune.h
Xterm_set.s:	term_set.c config.h node.h page.h tty.h tune.h
Xtty_set.s:	tty_set.c tty.h
Xtmpnam.s:	tmpnam.c config.h
Xuserlist.s:	userlist.c node.h page.h tune.h vn.h
Xvn.s:		vn.c node.h tty.h
Xvnglob.s:	vnglob.c config.h brk.h head.h node.h page.h tune.h
/
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)