From giles@nemeton.com.au  Thu Jan  2 03:34:36 1997
Received: from perki0.connect.com.au (perki0.connect.com.au [192.189.54.85])
          by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id DAA29726
          for <freebsd-gnats-submit@freebsd.org>; Thu, 2 Jan 1997 03:34:35 -0800 (PST)
Received: (from Unemeton@localhost) by perki0.connect.com.au id WAA22167
  (8.7.6h/IDA-1.6); Thu, 2 Jan 1997 22:34:13 +1100 (EST)
Subject:

>Number:         2361
>Category:       junk
>Synopsis:       
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan  2 03:40:01 PST 1997
>Closed-Date:    Mon Jan 6 17:41:17 PST 1997
>Last-Modified:  Tue Nov 27 19:23:30 PST 2001
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: fenner 
State-Changed-When: Mon Jan 6 17:41:17 PST 1997 
State-Changed-Why:  
GNATS misfiled this; it was meant to be a followup to PR#bin/777. 
>Unformatted:
 >Received: from nemeton.com.au (localhost.nemeton.com.au [127.0.0.1])
           by nemeton.com.au (8.8.4/8.8.4) with SMTP
 	  id WAA05672; Thu, 2 Jan 1997 22:30:59 +1100 (EST)
 Sender: giles@nemeton.com.au
 Message-ID: <32CB9C73.41C67EA6@nemeton.com.au>
 Date: Thu, 02 Jan 1997 22:30:59 +1100
 From: Giles Lean <giles@nemeton.com.au>
 Organization: Nemeton Pty. Ltd.
 X-Mailer: Mozilla 3.01 (X11; I; BSD/386 uname failed)
 MIME-Version: 1.0
 To: freebsd-gnats-submit@freebsd.org, asami@cs.berkeley.edu
 CC: giles@nemeton.com.au
 Subject: Re: bin/777: patch doesn't realize stdin is closed and asks questions forever
 Content-Type: multipart/mixed; boundary="------------446B9B3D2781E494167EB0E7"
 
 This is a multi-part message in MIME format.
 
 --------------446B9B3D2781E494167EB0E7
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 The following patch fixes this problem, although not very
 elegantly.  The structure of the patch code's user interaction
 doesn't lend itself to returning error codes. :-(
 
 -- 
 
 Giles Lean             <giles@nemeton.com.au>           +61 3 9480 2118
 Nemeton Pty. Ltd.                                   fax +61 3 9480 1771
 PGP Key fingerprint =  9F FB 28 37 81 F2 AC F3  8A B0 37 E5 73 CF 39 E7
 
 --------------446B9B3D2781E494167EB0E7
 Content-Type: text/plain; charset=us-ascii; name="patch_diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline; filename="patch_diff"
 
 Index: pch.c
 ===================================================================
 RCS file: /a/FreeBSD/CVS/src/gnu/usr.bin/patch/pch.c,v
 retrieving revision 1.8
 diff -c -r1.8 pch.c
 *** pch.c	1996/04/12 11:37:32	1.8
 --- pch.c	1997/01/02 11:24:53
 ***************
 *** 188,193 ****
 --- 188,195 ----
   bool
   there_is_another_patch()
   {
 +     int try_default_name = 0;
 + 
       if (p_base != 0L && p_base >= p_filesize) {
   	if (verbose)
   	    say1("done\n");
 ***************
 *** 230,239 ****
   	    bestguess = savestr(buf);
   	    filearg[0] = fetchname(buf, 0, FALSE);
   	}
   	if (filearg[0] == Nullch) {
 ! 	    ask1("No file found--skip this patch? [n] ");
 ! 	    if (*buf != 'y') {
 ! 		continue;
   	    }
   	    if (verbose)
   		say1("Skipping patch...\n");
 --- 232,247 ----
   	    bestguess = savestr(buf);
   	    filearg[0] = fetchname(buf, 0, FALSE);
   	}
 + 	else {
 + 	    /* keep count -- may be looping after losing /dev/tty */
 + 	    try_default_name++;
 + 	}
   	if (filearg[0] == Nullch) {
 ! 	    if (try_default_name < 3) {
 ! 	        ask1("No file found--skip this patch? [n] ");
 ! 	        if (*buf != 'y') {
 ! 		    continue;
 ! 	        }
   	    }
   	    if (verbose)
   		say1("Skipping patch...\n");
 
 --------------446B9B3D2781E494167EB0E7--
 
 
