From owner-freebsd-questions Mon Dec 21 19:09:45 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA09170 for freebsd-questions-outgoing; Mon, 21 Dec 1998 19:09:45 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from firewall.scitec.com.au (fgate.scitec.com.au [203.17.180.68]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA09156 for ; Mon, 21 Dec 1998 19:09:40 -0800 (PST) (envelope-from john.saunders@scitec.com.au) Received: by firewall.scitec.com.au; id OAA03388; Tue, 22 Dec 1998 14:09:36 +1100 (EST) Received: from mailhub.scitec.com.au(203.17.180.131) by fgate.scitec.com.au via smap (3.2) id xma003363; Tue, 22 Dec 98 14:09:09 +1100 Received: from saruman (saruman.scitec.com.au [203.17.182.108]) by mailhub.scitec.com.au (8.6.12/8.6.9) with SMTP id OAA15013; Tue, 22 Dec 1998 14:09:07 +1100 From: "John Saunders" To: "Michael Ryan" , "Jonathan Chen" Cc: "FreeBSD Support" Subject: RE: Mystery with pipe(), fork() and dup() Date: Tue, 22 Dec 1998 14:09:06 +1100 Message-ID: <003f01be2d58$6fc9f130$6cb611cb@saruman.scitec.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 In-Reply-To: X-Mimeole: Produced By Microsoft MimeOLE V4.72.2106.4 Importance: Normal Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I know. In the context of my program > if (pid == 0) > means the child process will execute the code, whereas > if (pid) > means the parent process will execute the code. 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. Cheers. -- . +-------------------------------------------------------+ ,--_|\ | John Saunders mailto:John.Saunders@scitec.com.au | / Oz \ | SCITEC LIMITED Phone +61294289563 Fax +61294289933 | \_,--\_/ | "By the time you make ends meet, they move the ends." | v +-------------------------------------------------------+ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message