[comp.bugs.4bsd] Patch to MH prompter to handle SIGHUP gracefully

vix@ubvax.UUCP (Paul Vixie) (05/13/87)

Our network is a little flakey today, and I just lost about 60 lines of reply
text because 'prompter' just croaks on a SIGHUP, without leaving your text in
Mail/draft.  The fix was easy enough... I put it into the #ifdef's for BSD42,
since all the other signal and setjmp stuff seems to be that way -- I don't
know why, but since I don't run SYSV, it doesn't really matter to me.

Two questions, then the patch: (1) who do I mail this to to have it included in
the official release?  (2) how do I get a more recent release? This patch is
for the version of prompter.c that came on the 4.3BSD tape, namely MH 6.2. I
know that MH 6.5 exists, but I don't know how to get it.

cd to /usr/src/new/mh/uip and run 'patch' over this article:

Index: prompter.c

*** prompter.c.ucb	Wed May 13 11:54:01 1987
--- prompter.c	Wed May 13 12:04:23 1987
***************
*** 80,85 ****
--- 80,87 ----
  
  #ifdef	BSD42
  static jmp_buf sigenv;
+ static jmp_buf sighup_env;
+ static int sighup_func() { longjmp(sighup_env, 1); }
  #endif	BSD42
  
  /*  */
***************
*** 221,226 ****
--- 223,234 ----
      sigint = 0;
      setsig (SIGINT, intrser);
  
+ #ifdef BSD42
+     if (setjmp(sighup_env))
+ 	goto sighup;
+     signal(SIGHUP, sighup_func);
+ #endif BSD42
+ 
      for (state = FLD;;) {
  	switch (state = m_getfld (state, name, field, sizeof field, in)) {
  	    case FLD: 
***************
*** 323,328 ****
--- 331,341 ----
      if (body)
  	printf ("--------\n");
      (void) fflush (stdout);
+ 
+ #ifdef BSD42
+ sighup: ;
+     (void) signal(SIGHUP, SIG_IGN);
+ #endif BSD42
  
      (void) fclose (in);
      (void) fclose (out);