From msmith@cain.atrad.adelaide.edu.au  Sun Sep  8 19:33:28 1996
Received: from who.cdrom.com (who.cdrom.com [204.216.27.3])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id TAA17343
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 8 Sep 1996 19:33:27 -0700 (PDT)
Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120])
          by who.cdrom.com (8.7.5/8.6.11) with ESMTP id TAA03550
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 8 Sep 1996 19:30:41 -0700 (PDT)
Received: from cain.atrad.adelaide.edu.au [203.20.121.17] by genesis.atrad.adelaide.edu.au (8.6.12/8.6.9) with ESMTP id LAA26575 for <FreeBSD-gnats-submit@freebsd.org>; Mon, 9 Sep 1996 11:59:15 +0930
Received: (from msmith@localhost) by cain.atrad.adelaide.edu.au (8.6.12/8.6.9) id LAA11012; Mon, 9 Sep 1996 11:59:13 +0930
Message-Id: <199609090229.LAA11012@cain.atrad.adelaide.edu.au>
Date: Mon, 9 Sep 1996 11:59:13 +0930
From: Michael Smith <msmith@cain.atrad.adelaide.edu.au>
Reply-To: msmith@cain.atrad.adelaide.edu.au
To: FreeBSD-gnats-submit@freebsd.org
Subject: ftp fails to flush output
X-Send-Pr-Version: 3.2

>Number:         1589
>Category:       bin
>Synopsis:       [PATCH] ftp fails to flush output
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    msmith
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep  8 19:40:03 PDT 1996
>Closed-Date:    Sun Aug 5 01:44:47 PDT 2001
>Last-Modified:  Sun Aug 05 01:45:10 PDT 2001
>Originator:     Michael Smith
>Release:        FreeBSD 2.1-STABLE i386
>Organization:
Genesis Software
>Environment:

	Using /usr/bin/ftp as a slave process on the end of a pipe.

>Description:

	The 'ftp' program fails to flush its output after each command,
	meaning that a driving program may not receive the results of
	a command until more output is produced.

>How-To-Repeat:

	...should be inferrable from context.

>Fix:

	(warning, X snarf-barf will have smashed tabs)

--- /usr/src/usr.bin/ftp/cmds.c Sat Aug 26 18:33:43 1995
+++ cmds.c      Wed Jun  5 12:55:26 1996
@@ -1198,6 +1198,7 @@
                        return;
        }
        recvrequest(cmd, argv[2], argv[1], "w", 0);
+       fflush(stdout);         /* flush results in case commands are coming from a pipe */
 }
 
 /*

	



>Release-Note:
>Audit-Trail:

From: Warner Losh <imp@village.org>
To: freebsd-gnats-submit@freebsd.org, msmith@cain.atrad.adelaide.edu.au
Cc:  Subject: Re: bin/1589: ftp fails to flush output
Date: Tue, 17 Dec 1996 18:42:54 -0700

 This patch looks interesting, but it only handles the case where you
 are doing an ls.  A more general form is needed.  The best place to do
 this would be in the main loop at around line 257 of main.c.  If you
 always flushed stdout here, rather than just if we're running from a
 tty, then you would have general results.  That is change:
 	for (;;) {
 		if (fromatty) {
 			printf("ftp> ");
 			(void) fflush(stdout);
 		}
 to	for (;;) {
 		if (fromatty)
 			printf("ftp> ");
 		(void) fflush(stdout);
State-Changed-From-To: open->suspended 
State-Changed-By: phk 
State-Changed-When: Mon May 25 01:10:03 PDT 1998 
State-Changed-Why:  
Awaiting committer 
Responsible-Changed-From-To: freebsd-bugs->msmith 
Responsible-Changed-By: hoek 
Responsible-Changed-When: Sat May 20 21:04:13 PDT 2000 
Responsible-Changed-Why:  
Any comments?  This seems to fall into the category of "if you don't do 
it, nobody else will".  I see Tue, 17 Dec 1996 18:42:54 -0700 on my 
screen. 
State-Changed-From-To: suspended->closed 
State-Changed-By: jon 
State-Changed-When: Sun Aug 5 01:44:47 PDT 2001 
State-Changed-Why:  
fix committed to -CURRENT. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=1589 
>Unformatted:
