[net.sources] fixes to visual.c for 4.2

john@bolton.UUCP (John Nelson) (01/16/84)

I have recieved a few requests for my fixes to the vnews distribution,
so I am posting them.  The version of vnews that I run is somewhat different
than the "standard" version, so I am just posting the diffs from my 4.1
version to my 4.2 version.  I have added a new flag (BSD42) so the source
is still backward compatible with the old system.

Also, there was a macro CNTL(_c) which conflicted with one of the system
header macros - so I changed it to CONTROL(_c).  I was not sure if this
was part of the standard distribution, so I did not include these
differences in the supplied diff.

Note: please send any replies to decvax!genrad!john  .  We are currently
running two systems: 4.1 and 4.2.  If you reply to this article, the
mail will get to me, but it will just take longer.

*** visual.c	Mon Jan 16 10:22:26 1984
--- visual.c.bak	Mon Jan 16 10:20:36 1984
***************
*** 21,35
  
  #include <errno.h>
  #include "rparams.h"
- 
- #ifdef SIGVTALRM
- 	/* this MUST be 4.2BSD! */
- #define BSD42
- #endif SIGVTALRM
- 
- #ifdef BSD42
- #include <sys/dir.h>
- #else not BSD42
  #include <ndir.h>	/* this is the directory library header */
  #endif not BSD42
  

--- 21,26 -----
  
  #include <errno.h>
  #include "rparams.h"
  #include <ndir.h>	/* this is the directory library header */
  #ifdef MYDB
  #include "db.h"
***************
*** 31,38
  #include <sys/dir.h>
  #else
  #include <ndir.h>	/* this is the directory library header */
- #endif not BSD42
- 
  #ifdef MYDB
  #include "db.h"
  #endif

--- 22,27 -----
  #include <errno.h>
  #include "rparams.h"
  #include <ndir.h>	/* this is the directory library header */
  #ifdef MYDB
  #include "db.h"
  #endif
***************
*** 37,47
  #include "db.h"
  #endif
  
- #ifdef BSD42
- #define sigset signal
- #define BIT(_a) (1<<((_a)-1))
- #endif BSD42
- 
  #define CONTROL(_c)   ('_c'&037)
  
  #define ARTWLEN	(ROWS-2)/* number of lines used to display article */

--- 26,31 -----
  #include "db.h"
  #endif
  
  #define CONTROL(_c)   ('_c'&037)
  
  #define ARTWLEN	(ROWS-2)/* number of lines used to display article */
***************
*** 2097,2105
  	short tpgrp, getpgrp();
  
  retry:
- #ifdef BSD42
- 	sigblock(BIT(SIGTSTP)|BIT(SIGTTIN)|BIT(SIGTTOU));
- #else not BSD42
  	sigset(SIGTSTP, SIG_HOLD);
  	sigset(SIGTTIN, SIG_HOLD);
  	sigset(SIGTTOU, SIG_HOLD);

--- 2082,2087 -----
  	short tpgrp, getpgrp();
  
  retry:
  	sigset(SIGTSTP, SIG_HOLD);
  	sigset(SIGTTIN, SIG_HOLD);
  	sigset(SIGTTOU, SIG_HOLD);
***************
*** 2103,2109
  	sigset(SIGTSTP, SIG_HOLD);
  	sigset(SIGTTIN, SIG_HOLD);
  	sigset(SIGTTOU, SIG_HOLD);
- #endif not BSD42
  	if (ioctl(2, TIOCGPGRP, &tpgrp) != 0)
  		goto nottty;
  	if (tpgrp != getpgrp(0)) { /* not in foreground */

--- 2085,2090 -----
  	sigset(SIGTSTP, SIG_HOLD);
  	sigset(SIGTTIN, SIG_HOLD);
  	sigset(SIGTTOU, SIG_HOLD);
  	if (ioctl(2, TIOCGPGRP, &tpgrp) != 0)
  		goto nottty;
  	if (tpgrp != getpgrp(0)) { /* not in foreground */
***************
*** 2108,2116
  		goto nottty;
  	if (tpgrp != getpgrp(0)) { /* not in foreground */
  		sigset(SIGTTOU, SIG_DFL);
- #ifdef BSD42
- 		sigsetmask(sigblock(0) & ~BIT(SIGTTOU));
- #endif BSD42
  		kill(0, SIGTTOU);
  		/* job stops here waiting for SIGCONT */
  		goto retry;

--- 2089,2094 -----
  		goto nottty;
  	if (tpgrp != getpgrp(0)) { /* not in foreground */
  		sigset(SIGTTOU, SIG_DFL);
  		kill(0, SIGTTOU);
  		/* job stops here waiting for SIGCONT */
  		goto retry;
***************
*** 2118,2127
  	sigset(SIGTTIN, onstop);
  	sigset(SIGTTOU, onstop);
  	sigset(SIGTSTP, onstop);
! #ifdef BSD42
! 	sigsetmask(sigblock(0) & ~(BIT(SIGTSTP)|BIT(SIGTTIN)|BIT(SIGTTOU)));
! #endif BSD42
! #endif SIGTSTP
  	if (gtty(1, &oldtty) < 0)
  nottty:		xerror("Can't get tty modes");
  	newtty = oldtty;

--- 2096,2102 -----
  	sigset(SIGTTIN, onstop);
  	sigset(SIGTTOU, onstop);
  	sigset(SIGTSTP, onstop);
! #endif
  	if (gtty(1, &oldtty) < 0)
  nottty:		xerror("Can't get tty modes");
  	newtty = oldtty;
***************
*** 2215,2223
  	vflush();
  	ttycooked();
  	sigset(signo, SIG_DFL);
- #ifdef BSD42
- 	sigsetmask(sigblock(0) & ~BIT(signo));
- #endif BSD42
  	kill(0, signo);	/* stop here until continued */
  
  	fprintf(stderr,"Vnews restarted.");

--- 2190,2195 -----
  	vflush();
  	ttycooked();
  	sigset(signo, SIG_DFL);
  	kill(0, signo);	/* stop here until continued */
  
  	fprintf(stderr,"Vnews restarted.");