[news.software.b] EPS' changes to rn patchlevel 40 for NeXT and SunOS

epsilon@wet.UUCP (Eric P. Scott) (10/16/89)

These are my changes to rn patchlevel 40.  They are by no means
the ultimate patches--they are provided as a starting point for
further work.  These have been tested on NeXT 0.9 and SunOS 4.0.3.

The following are NOT addressed by this patch; you'll have to
deal with them manually.

Configure:
[NeXT only] identification as BSD
look for SIGTSTP in /usr/include/sys/signal.h rather than signal.h
[NeXT only] selection of /lib/cpp
if $contains 'abc +xyz' testcpp.out >/dev/null 2>&1 ; then
                 ^ add this space
Note: When you run Configure, answer y to the question:
is your "test" built into sh? for NeXT and SunOS.

common.h: (if needed)
raise MAXRCLINE from 1000 to 1500; HASHSIZ from 1103 to 1693
in NEWSHEADER change .UUCP to correct domain
in CANCELHEADER change .UUCP to correct domain

config.h/config.sh: (after running Configure)
[NeXT only] Configure mistakenly does not find vfork
undef vfork (in config.sh it's called novfork)
[SunOS only] SunOS has both ioctl and termio, use ioctl only
undef termio
[NeXT, or SunOS+YP]
define getpwent

newsetup.SH:
You might want to add some special treatment for alt.

Pnews.SH:
My restoration of the "recording" stuff isn't perfect; it doesn't
work properly with groups like rec.arts.tv.uk.

rn.1:
[NeXT only] put a .UC 6 after the .TH line before printing with
ptroff -man.

If you are using the rrn patches provided with nntp 1.5.6:
These "normally" reject one patch to ngdata.c since PL 40
added a #include "util.h"; you will have to edit in the
#include "server.h" manually.
	My patches introduce two conflicts:
	term.c: both fix the same problem in different ways.
	Install one or the other, but not both.
	newsetup.SH: do my patch first, then the rrn patch.
	Ignore the rejects.

All followups to news.software.b please.
					-=EPS=-
======= Cut here =======
*** ../old/Pnews.SH	Fri Nov 21 14:45:17 1986
--- Pnews.SH	Tue Oct 10 00:00:03 1989
***************
*** 102,110 ****
  help.
  
  If you've never posted an article to the net before, it is HIGHLY recommended
! that you read the netiquette document found in mod.announce.newusers so
  that you'll know to avoid the commonest blunders.  To do that, interrupt
! Pnews, and get to the top-level prompt of rn.  Say "g mod.announce.newusers"
  and you are on your way.
  
  EOM
--- 102,110 ----
  help.
  
  If you've never posted an article to the net before, it is HIGHLY recommended
! that you read the netiquette document found in news.announce.newusers so
  that you'll know to avoid the commonest blunders.  To do that, interrupt
! Pnews, and get to the top-level prompt of rn.  Say "g news.announce.newusers"
  and you are on your way.
  
  EOM
***************
*** 151,156 ****
--- 151,179 ----
      trap "$rescue" 2
  
  $echo ""
+ #: play recorded message
+ set X `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'`
+ shift
+ case $# in
+ 0|1)
+     ;;
+ *)
+     shift
+     if $test -s ${lib}/recording ; then
+ 	 ng=`$echo $1 | $sed "s/,.*//"`
+ 	_rec1=${lib}/`$sed -n "/^$ng/s/^.*	//p" ${lib}/recording`
+ 	_tmp=`$echo $ng |$sed "s/\..*//"`
+ 	_rec2=${lib}/`$cat -s ${lib}/recording|$grep ${_tmp}.all|$sed "s/^.*	//"`
+ 	if $test -f ${_rec1} ; then
+ 	    $cat -s ${_rec1}
+ 	fi
+ 	if $test -f ${_rec2} ; then
+ 	    $cat -s ${_rec2}
+ 	fi
+     fi
+     ;;
+ esac
+ 
  set X `$sed < $tmpart -n -e '/^Distribution: /{' -e p -e q -e '}' -e '/^$/q'`
  shift
  case $# in
***************
*** 169,191 ****
  esac
  shift
  
- #: play recorded message
- #if $test -s ${lib}/recording ; then
- #     ng=`$echo $1 | $sed "s/,.*//"`
- #    _rec1=${lib}/`$sed -n "/^$ng/s/^.*	//p" ${lib}/recording`
- #    _tmp=`$echo $ng |$sed "s/\..*//"`
- #    _rec2=${lib}/`$cat -s ${lib}/recording|$grep ${_tmp}.all|$sed "s/^.*	//"`
- #    if $test -f ${_rec1} ; then
- #	$cat -s ${_rec1}
- #    fi
- #    if $test -f ${_rec2} ; then
- #	$cat -s ${_rec2}
- #    fi
- #fi
- 
  # tell them what we think they are doing... !DIST!
  case $1 in
! net.*|world.*|comp.*|news.*|sci.*|rec.*|misc.*|soc.*|talk.*|mod.*)
      $cat <<'EOM'
  This program posts news to thousands of machines throughout the entire
  civilized world.  You message will cost the net hundreds if not thousands of
--- 192,200 ----
  esac
  shift
  
  # tell them what we think they are doing... !DIST!
  case $1 in
! world.*|comp.*|news.*|sci.*|rec.*|misc.*|soc.*|talk.*)
      $cat <<'EOM'
  This program posts news to thousands of machines throughout the entire
  civilized world.  You message will cost the net hundreds if not thousands of
***************
*** 493,499 ****
      ;;
  esac
  case $ng in
! net.*|mod.*|comp.*|news.*|sci.*|rec.*|misc.*|soc.*|talk.*)
      defdist=world
      dist=h
      ;;
--- 502,508 ----
      ;;
  esac
  case $ng in
! comp.*|news.*|sci.*|rec.*|misc.*|soc.*|talk.*)
      defdist=world
      dist=h
      ;;
***************
*** 518,525 ****
  
  Your local distribution prefixes are:
      Local organization:	$loc
!     Organization:		$org
!     City:			$city
      $stpr:  		$state
      Country:		$cntry
      Continent:		$cont
--- 527,534 ----
  
  Your local distribution prefixes are:
      Local organization:	$loc
!     Organization:	$org
!     City:		$city
      $stpr:  		$state
      Country:		$cntry
      Continent:		$cont
***************
*** 546,552 ****
  	;;
      ''|$loc*|$org*|$city*|$state*|$cntry*|$cont*|$defdist)
  	;;
!     net*|world*|comp*|news*|sci*|rec*|misc*|soc*|talk*)
  	dist=''
  	;;
      *)  
--- 555,561 ----
  	;;
      ''|$loc*|$org*|$city*|$state*|$cntry*|$cont*|$defdist)
  	;;
!     world*|comp*|news*|sci*|rec*|misc*|soc*|talk*)
  	dist=''
  	;;
      *)  
***************
*** 563,576 ****
      esac
  done
  
! case $ng in
! *net.general*)
!     follow=`echo "$ng" | sed 's/net\.general/net.followup/g'`
!     ;;
! *)
!     follow=""
!     ;;
! esac
  
  case $# in
  0)
--- 572,578 ----
      esac
  done
  
! follow=""
  
  case $# in
  0)
*** ../old/art.c	Mon Feb  2 15:24:25 1987
--- art.c	Sun Oct  8 20:15:48 1989
***************
*** 104,110 ****
      if (fstat(artfp->_file,&filestat))
  			    /* get article file stats */
  	return DA_CLEAN;
!     if (filestat.st_mode & S_IFMT != S_IFREG)
  	return DA_NORM;
      artsize = filestat.st_size;
  			    /* from that get article size */
--- 104,110 ----
      if (fstat(artfp->_file,&filestat))
  			    /* get article file stats */
  	return DA_CLEAN;
!     if ((filestat.st_mode & S_IFMT) != S_IFREG)
  	return DA_NORM;
      artsize = filestat.st_size;
  			    /* from that get article size */
*** ../old/newsetup.SH	Fri Nov 21 14:45:19 1986
--- newsetup.SH	Mon Oct  9 23:19:49 1989
***************
*** 47,71 ****
  $sort <\$active | $sed >/tmp/n.tmp\$\$	\\
  	-e 's/^\([^ ]*\) .*\$/\1:/'	\\
  	-e '/^control:/{'		\\
  	-e "  w /tmp/n.test\$\$"	\\
  	-e '  d'			\\
  	-e '}'				\\
  	-e '/^junk:/{'			\\
  	-e "  w /tmp/n.test\$\$"	\\
  	-e '  d'			\\
  	-e '}'				\\
  	-e '/test:/{'			\\
  	-e "  w /tmp/n.test\$\$"	\\
  	-e '  d'			\\
  	-e '}'				\\
- 	-e "/^net\./{"			\\
- 	-e "  w /tmp/n.net\$\$"		\\
- 	-e '  d'			\\
- 	-e '}'				\\
- 	-e "/^mod\./{"			\\
- 	-e "  w /tmp/n.mod\$\$"		\\
- 	-e '  d'			\\
- 	-e '}'				\\
  	-e "/^\$locorg\./{"		\\
  	-e "  w /tmp/n.\$locorg\$\$"	\\
  	-e '  d'			\\
--- 47,66 ----
  $sort <\$active | $sed >/tmp/n.tmp\$\$	\\
  	-e 's/^\([^ ]*\) .*\$/\1:/'	\\
  	-e '/^control:/{'		\\
+ 	-e "  s/:/!/"	\\
  	-e "  w /tmp/n.test\$\$"	\\
  	-e '  d'			\\
  	-e '}'				\\
  	-e '/^junk:/{'			\\
+ 	-e "  s/:/!/"	\\
  	-e "  w /tmp/n.test\$\$"	\\
  	-e '  d'			\\
  	-e '}'				\\
  	-e '/test:/{'			\\
+ 	-e "  s/:/!/"	\\
  	-e "  w /tmp/n.test\$\$"	\\
  	-e '  d'			\\
  	-e '}'				\\
  	-e "/^\$locorg\./{"		\\
  	-e "  w /tmp/n.\$locorg\$\$"	\\
  	-e '  d'			\\
***************
*** 82,93 ****
  	-e "  w /tmp/n.\$state\$\$"	\\
  	-e '  d'			\\
  	-e '}'				\\
- 	-e "/^fa\./{"			\\
- 	-e "  w /tmp/n.fa\$\$"		\\
- 	-e '  d'			\\
- 	-e '}'
- 
- $sed </tmp/n.tmp\$\$ >/tmp/n.local\$\$	\\
  	-e "/^\$cntry\./{" 		\\
  	-e "  w /tmp/n.\$cntry\$\$"	\\
  	-e '  d'			\\
--- 77,82 ----
***************
*** 95,102 ****
  	-e "/^\$cont\./{" 		\\
  	-e "  w /tmp/n.\$cont\$\$"	\\
  	-e '  d'			\\
! 	-e '}'				\\
  	-e "/^to\./{"			\\
  	-e "  w /tmp/n.to\$\$"		\\
  	-e '  d'			\\
  	-e '}'				\\
--- 84,94 ----
  	-e "/^\$cont\./{" 		\\
  	-e "  w /tmp/n.\$cont\$\$"	\\
  	-e '  d'			\\
! 	-e '}'
! 
! $sed </tmp/n.tmp\$\$ >/tmp/n.local\$\$	\\
  	-e "/^to\./{"			\\
+ 	-e "  s/:/!/"	\\
  	-e "  w /tmp/n.to\$\$"		\\
  	-e '  d'			\\
  	-e '}'				\\
***************
*** 144,150 ****
      /tmp/n.\$state\$\$ \\
      /tmp/n.\$cntry\$\$ \\
      /tmp/n.\$cont\$\$ \\
-     /tmp/n.mod\$\$ \\
      /tmp/n.news\$\$ \\
      /tmp/n.comp\$\$ \\
      /tmp/n.sci\$\$ \\
--- 136,141 ----
***************
*** 152,160 ****
      /tmp/n.soc\$\$ \\
      /tmp/n.misc\$\$ \\
      /tmp/n.talk\$\$ \\
-     /tmp/n.net\$\$ \\
-     /tmp/n.fa\$\$ \\
      /tmp/n.test\$\$ \\
  | $uniq >\$dotdir/.newsrc
  
  $rm -f	/tmp/n.to\$\$ \\
--- 143,150 ----
      /tmp/n.soc\$\$ \\
      /tmp/n.misc\$\$ \\
      /tmp/n.talk\$\$ \\
      /tmp/n.test\$\$ \\
+     /tmp/n.to\$\$ \\
  | $uniq >\$dotdir/.newsrc
  
  $rm -f	/tmp/n.to\$\$ \\
***************
*** 166,172 ****
  	/tmp/n.\$state\$\$ \\
  	/tmp/n.\$cntry\$\$ \\
  	/tmp/n.\$cont\$\$ \\
- 	/tmp/n.mod\$\$ \\
  	/tmp/n.news\$\$ \\
  	/tmp/n.comp\$\$ \\
  	/tmp/n.sci\$\$ \\
--- 156,161 ----
***************
*** 173,180 ****
  	/tmp/n.soc\$\$ \\
  	/tmp/n.rec\$\$ \\
  	/tmp/n.talk\$\$ \\
- 	/tmp/n.net\$\$ \\
- 	/tmp/n.fa\$\$ \\
  	/tmp/n.misc\$\$ \\
  	/tmp/n.test\$\$
  
--- 162,167 ----
***************
*** 182,188 ****
  Done.
  
  If you have never used the news system before, you may find the articles
! in mod.announce.newuser to be helpful.  There is also a manual entry for rn.
  
  To get rid of newsgroups you aren't interested in, use the 'u' command.
  Type h for help at any time while running rn.
--- 169,175 ----
  Done.
  
  If you have never used the news system before, you may find the articles
! in news.announce.newusers to be helpful.  There is also a manual entry for rn.
  
  To get rid of newsgroups you aren't interested in, use the 'u' command.
  Type h for help at any time while running rn.
*** ../old/newsnews.SH	Fri Nov 21 13:42:52 1986
--- newsnews.SH	Mon Oct  9 23:24:36 1989
***************
*** 23,28 ****
  her own message whenever something new happens to rn, and then the file
  will again be displayed, just once for each person.
  
! Larry Wall	sdcrdcf!lwall
  !GROK!THIS!
  $eunicefix newsnews
--- 23,28 ----
  her own message whenever something new happens to rn, and then the file
  will again be displayed, just once for each person.
  
! Larry Wall	lwall@jpl-devvax.jpl.nasa.gov
  !GROK!THIS!
  $eunicefix newsnews
*** ../old/rn.1	Fri Nov 21 14:39:24 1986
--- rn.1	Tue Oct 10 22:26:38 1989
***************
*** 1416,1422 ****
  .Sp
  Newsgroups: %(%F=^$?%C:%F)
  .br
! Subject: %(%S=^$?%"\n\nSubject: ":Re: %S)
  .br
  Summary:
  .br
--- 1416,1422 ----
  .Sp
  Newsgroups: %(%F=^$?%C:%F)
  .br
! Subject: %(%S=^$?%"\en\enSubject: ":Re: %S)
  .br
  Summary:
  .br
***************
*** 1430,1436 ****
  .br
  Followup-To: 
  .br
! Distribution: %(%i=^$?%"\nDistribution: ":%D)
  .br
  Organization: %o
  .br
--- 1430,1436 ----
  .br
  Followup-To: 
  .br
! Distribution: %(%i=^$?%"\enDistribution: ":%D)
  .br
  Organization: %o
  .br
***************
*** 1630,1636 ****
  .I rn
  that it should gobble up one character after the F.
  .SH AUTHOR
! Larry Wall <lwall@sdcrdcf.UUCP>
  .br
  Regular expression routines are borrowed from emacs, by James Gosling.
  .SH FILES
--- 1630,1636 ----
  .I rn
  that it should gobble up one character after the F.
  .SH AUTHOR
! Larry Wall <lwall@jpl-devvax.jpl.nasa.gov>
  .br
  Regular expression routines are borrowed from emacs, by James Gosling.
  .SH FILES
*** ../old/subs.help.SH	Fri Nov 21 13:42:37 1986
--- subs.help.SH	Mon Oct  9 23:07:05 1989
***************
*** 21,27 ****
  c	Current newsgroup, directory form
  C	Current newsgroup, dot form
  d	Full name of newsgroup directory (%P/%c)
! D	Distribution line from current article\
  f	Who the current article is from
  F	Newsgroups to followup to (from Newsgroups and Followup-To)
  h	(This help message)
--- 21,27 ----
  c	Current newsgroup, directory form
  C	Current newsgroup, dot form
  d	Full name of newsgroup directory (%P/%c)
! D	Distribution line from current article
  f	Who the current article is from
  F	Newsgroups to followup to (from Newsgroups and Followup-To)
  h	(This help message)
***************
*** 41,47 ****
  r	Last reference (parent article id)
  R	References list for followup article
  s	Subject, with all Re's and (nf)'s stripped off
! S	Subject, with one Re stripped off\
  t	New To line derived from From and Reply-To (Internet format)
  T	New To line derived from Path
  u	Number of unread articles
--- 41,47 ----
  r	Last reference (parent article id)
  R	References list for followup article
  s	Subject, with all Re's and (nf)'s stripped off
! S	Subject, with one Re stripped off
  t	New To line derived from From and Reply-To (Internet format)
  T	New To line derived from Path
  u	Number of unread articles
*** ../old/term.c	Fri Nov 21 14:39:32 1986
--- term.c	Mon Oct  2 19:43:21 1989
***************
*** 121,126 ****
--- 121,129 ----
      char *tgetstr();
      char *s;
      int status;
+ #ifdef TIOCGWINSZ
+     struct winsize winsize;
+ #endif
  
  #ifdef PENDING
  #ifndef FIONREAD
***************
*** 204,209 ****
--- 207,218 ----
  	else
  	    CR = "\r";
      }
+ #ifdef TIOCGWINSZ
+ 	if (ioctl(1, TIOCGWINSZ, &winsize)>=0) {
+ 		if (winsize.ws_row>0) LINES=winsize.ws_row;
+ 		if (winsize.ws_col>0) COLS=winsize.ws_col;
+ 	}
+ #endif
  #else
      ??????				/* Roll your own... */
  #endif
*** ../old/util.c	Fri Nov 21 14:24:16 1986
--- util.c	Tue Oct 10 20:20:03 1989
***************
*** 32,39 ****
  char *s, *shl;
  {
      int status, pid, w;
!     register int (*istat)(), (*qstat)();
!     int (*signal())();
      char *shell;
  
  #ifdef SIGTSTP
--- 32,39 ----
  char *s, *shl;
  {
      int status, pid, w;
!     register void (*istat)(), (*qstat)();
!     void (*signal())();
      char *shell;
  
  #ifdef SIGTSTP