Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Dec 1998 10:01:25 PST
From:      Michael Ryan <mike@NetworX.ie>
To:        John Saunders <john.saunders@scitec.com.au>
Cc:        Michael Ryan <mike@NetworX.ie>, Jonathan Chen <jonc@pinnacle.co.nz>, FreeBSD Support <questions@FreeBSD.ORG>
Subject:   RE: Mystery with pipe(), fork() and dup()
Message-ID:  <ECS9812221025B@NetworX.ie>

next in thread | raw e-mail | index | archive | help
On Tue, 22 Dec 1998 14:09:06 +1100 John Saunders wrote:

> In the context of your program, (pid == 0) means that the
> output of grep is piped into more. But for (pid) it means
> that the output of more is piped into grep. A certain
> recipe for screwing up the output of more.

I believe this is incorrect.  The code within the block
	if (pid == 0) {
	   :
	   :
	}
dups the write side of the pipe onto stdout and then
execs grep.  The code following this block dups the
read side of the pipe onto stdin and exec more.
Therefore, grep is being piped into more.

Bye,
Mike
mike@NetworX.ie
www.NetworX.ie
---




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



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