From nobody  Fri Feb 14 18:25:48 1997
Received: (from nobody@localhost)
          by freefall.freebsd.org (8.8.5/8.8.5) id SAA21258;
          Fri, 14 Feb 1997 18:25:48 -0800 (PST)
Message-Id: <199702150225.SAA21258@freefall.freebsd.org>
Date: Fri, 14 Feb 1997 18:25:48 -0800 (PST)
From: graphix@iastate.edu
To: freebsd-gnats-submit@freebsd.org
Subject: fetch prints messages to stdout even when receiving file to stdout
X-Send-Pr-Version: www-1.0

>Number:         2739
>Category:       bin
>Synopsis:       fetch prints messages to stdout even when receiving file to stdout
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jmg
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 14 18:30:01 PST 1997
>Closed-Date:    Sun Feb 16 20:11:56 PST 1997
>Last-Modified:  Sun Feb 16 20:13:13 PST 1997
>Originator:     Kent Vander Velden
>Release:        3.0-Current
>Organization:
Iowa State University
>Environment:
FreeBSD pseudo.cc.iastate.edu 3.0-CURRENT FreeBSD 3.0-CURRENT #0: Sun Feb  9 02:37:42 CST 1997     kent@pseudo.cc.iastate.edu:/usr/src/sys/compile/PSEUDO  i386

>Description:
Fetch will print messages to stdout even when receiving a file to stdout.
This causes a problem since the fetch messages becomming intertwined 
with the received file.	
>How-To-Repeat:
Fetch a file to stdout and redirect to a file.  Tail and head the file
and you will see fetch output.	
>Fix:
My solution was to patch fetch/main.c to print to stderr instead of 
stdout.

retrieving revision 1.34
diff -r1.34 main.c
310,311c310,311
<       printf ("%s", s);
<       fflush (stdout);
---
>       fprintf (stderr, "%s", s);
>       fflush (stderr);
318c318
<           printf ("\r%s: 100%%", s);
---
>           fprintf (stderr, "\r%s: 100%%", s);
320c320
<           printf ("\r%s: %qd Kbytes", s, (quad_t)bytes/1024);
---
>           fprintf (stderr, "\r%s: %qd Kbytes", s, (quad_t)bytes/1024);
322c322
<       printf ("\n%qd bytes transfered in %.1f seconds", (quad_t)bytes, d); 
---
>       fprintf (stderr, "\n%qd bytes transfered in %.1f seconds", (quad_t)byt, d); 
325c325
<           printf ("  (%.0f bytes/s)\n", d);
---
>           fprintf (stderr, "  (%.0f bytes/s)\n", d);
328c328
<           printf ("  (%.2f kB/s)\n", d);
---
>           fprintf (stderr, "  (%.2f kB/s)\n", d);
341c341
<       printf ("\r%s: %2qd%%", s, (quad_t)bytes/(size/100));
---
>       fprintf (stderr, "\r%s: %2qd%%", s, (quad_t)bytes/(size/100));
343c343
<       printf ("\r%s: %2qd%%", s, (quad_t)100*bytes/size);
---
>       fprintf (stderr, "\r%s: %2qd%%", s, (quad_t)100*bytes/size);
345,346c345,346
<       printf ("\r%s: %qd kB", s, (quad_t)bytes/1024);
<     fflush (stdout);
---
>       fprintf (stderr, "\r%s: %qd kB", s, (quad_t)bytes/1024);
>     fflush (stderr);

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jmg 
Responsible-Changed-By: jmg 
Responsible-Changed-When: Fri Feb 14 19:48:04 PST 1997 
Responsible-Changed-Why:  
I've been mucking around in fetch... might as well take this one too... 

From: John-Mark Gurney <jmg@nike.efn.org>
To: graphix@iastate.edu
Cc: freebsd-gnats-submit@freebsd.org,
        GNATS Management <gnats@freefall.freebsd.org>,
        freebsd-bugs@freefall.freebsd.org
Subject: Re: bin/2739: fetch prints messages to stdout even when receiving file to stdout
Date: Fri, 14 Feb 1997 19:47:59 -0800 (PST)

 On Fri, 14 Feb 1997 graphix@iastate.edu wrote:
 
 thanks for the bug report...
 
 > >Synopsis:       fetch prints messages to stdout even when receiving file to stdout
 > >Description:
 > Fetch will print messages to stdout even when receiving a file to stdout.
 > This causes a problem since the fetch messages becomming intertwined 
 > with the received file.	
 > >How-To-Repeat:
 > Fetch a file to stdout and redirect to a file.  Tail and head the file
 > and you will see fetch output.	
 > >Fix:
 > My solution was to patch fetch/main.c to print to stderr instead of 
 > stdout.
 > 
 > retrieving revision 1.34
 > diff -r1.34 main.c
 
 [patch deleted]
 
 could you send me the patch as a context diff instead?  thanks... ttyl...
 
 John-Mark
 
 gurney_j@efn.org
 http://resnet.uoregon.edu/~gurney_j/
 Modem/FAX: (541) 683-6954   (FreeBSD Box)
 
 Live in Peace, destroy Micro$oft, support free software, run FreeBSD (unix)
 
State-Changed-From-To: open->closed 
State-Changed-By: jmg 
State-Changed-When: Sun Feb 16 20:11:56 PST 1997 
State-Changed-Why:  
closed in rev 1.37 of src/usr.bin/fetch/main.c 
>Unformatted:
