Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Mar 1997 08:40:49 +0100
From:      j@uriah.heep.sax.de (J Wunsch)
To:        bugs@FreeBSD.ORG
Subject:   Re: bin/2870: fetch won't restart http transfers
Message-ID:  <Mutt.19970305084049.j@uriah.heep.sax.de>
In-Reply-To: <Pine.BSF.3.95.970304092006.20884B-100000@alive.znep.com>; from Marc Slemko on Mar 4, 1997 09:23:13 -0700
References:  <9703041506.AA26430@halloran-eldar.lcs.mit.edu> <Pine.BSF.3.95.970304092006.20884B-100000@alive.znep.com>

next in thread | previous in thread | raw e-mail | index | archive | help
As Marc Slemko wrote:

> > This is incorrect.  The correct code would be:
> > 
> > 	if (to_stdout)
> > 		local = fopen("/dev/stdout", restarting ? "a" : "w");
> > 	else
> > 		local = fopen(fs->fs_outputfile, restarting ? "a" : "w");
> 
> I actually thought about it, but:
> 
> 	1. how are we going to append to stdout and what meaning
> 	   does that have?

It will append to it. :-)  OTOH, it seems opening it for writing does
yield the exact same behaviour in FreeBSD.

You can try this with something like:

j@uriah 281% cat foo.c
#include <stdio.h>

int
main(void)
{
	FILE *f;

	f = fopen("/dev/stdout", "w");

	fprintf(f, "Hello, world!\n");

	return 0;
}
j@uriah 282% cc foo.c
j@uriah 283% ( echo "Goodbye world" ; ./a.out ) > foobar
j@uriah 284% cat foobar
Goodbye world
Hello, world!

The result is identical, regardless of whether "w" or "a" is used.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Mutt.19970305084049.j>