[net.news.b] Fix to ^Z bug in vnews

wls@astrovax.UUCP (09/18/83)

Here is a bug fix for the problem with ^Z's when running vnews under 4.1BSD.
Since there was no reply to my request for a fix I rolled up my sleeves and
figured it out myself.  It wasn't too hard.  For those unaware of this problem:
vnews places one in an editor to compose a reply or a followup when one gives
the `r' or `f' command.  One then often wants to stop the editor by pressing
^Z, for instance, to check on the name of a file one wants to reference.  There
is no problem stopping the editor.  However when tries to continue the editor,
the terminal is left in limbo.  The cure is to disable catching the SIGTSTP in
vnews while the editor process is alive. The fix follows:
--- William L. Sebok {allegra,cbosgd,decvax,ihnp4,kpno}!astrovax!wls
----------------------------------------------------
diff visual.c.old visual.c
1371,1378c1371,1383
<	char *env[100], **envp;
<	char a[BUFLEN + 2];
<	extern char **environ;
<
<	if (!(flags & BKGRND)) {
<		botscreen();
<		ttycooked();
<	}
---
>	char *env[100], **envp;
>	char a[BUFLEN + 2];
>	extern char **environ;
>
> #ifdef SIGTSTP
> 		sigset(SIGTSTP, SIG_DFL);
> 		sigset(SIGTTIN, SIG_DFL);
> 		sigset(SIGTTOU, SIG_DFL);
> #endif
>	if (!(flags & BKGRND)) {
>		botscreen();
>		ttycooked();
>	}

1411,1416c1416,1426
<		}
<		signal(SIGQUIT, savequit);
<		ttyraw();
<		clearok(curscr, 1);
<	}
<}
---
>		}
>		signal(SIGQUIT, savequit);
>		ttyraw();
>		clearok(curscr, 1);
> #ifdef SIGTSTP
> 		sigset(SIGTSTP, onstop);
> 		sigset(SIGTTIN, onstop);
> 		sigset(SIGTTOU, onstop);
> #endif
>	}
>}

2012,2017c2022,2027
<	ttycooked();
<	sigset(signo, SIG_DFL);
< 	kill(0, signo);	/* stop here until continued */
<
<	fprintf(stderr,"Vnews restarted.");
<	sigset(signo, onstop);
---
>	ttycooked();
>	sigset(signo, SIG_DFL);
> 	kill(getpid(), signo);	/* stop here until continued */
>
>	fprintf(stderr,"Vnews restarted.");
>	sigset(signo, onstop);