From owner-freebsd-questions Tue Dec 22 02:05:29 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA24701 for freebsd-questions-outgoing; Tue, 22 Dec 1998 02:05:29 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from sam.networx.ie (ts08-068.dublin.indigo.ie [194.125.205.198]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA24695 for ; Tue, 22 Dec 1998 02:05:24 -0800 (PST) (envelope-from mike@NetworX.ie) Received: from mike (mike.NetworX.ie [194.9.12.33]) by sam.networx.ie (8.8.5/8.8.5) with SMTP id JAA29965; Tue, 22 Dec 1998 09:53:21 GMT X-Organisation: I.T. NetworX Ltd X-Business: Network Applications, Consultancy and Training X-Address: Stonebridge House, Shankill, Co. Dublin, Ireland X-Voice: +353-1-28-27-233 X-Fax: +353-1-28-27-230 Date: Tue, 22 Dec 1998 10:01:25 PST From: Michael Ryan Subject: RE: Mystery with pipe(), fork() and dup() To: John Saunders cc: Michael Ryan , Jonathan Chen , FreeBSD Support Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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