From owner-freebsd-questions Tue Jul 17 0:37:18 2001 Delivered-To: freebsd-questions@freebsd.org Received: from beta.root-servers.ch (gamma.root-servers.ch [195.49.62.126]) by hub.freebsd.org (Postfix) with SMTP id 0540537B401 for ; Tue, 17 Jul 2001 00:37:11 -0700 (PDT) (envelope-from gabriel_ambuehl@buz.ch) Received: (qmail 39330 invoked from network); 17 Jul 2001 07:37:09 -0000 Received: from dclient106-17.hispeed.ch (HELO athlon550) (62.2.106.17) by beta.root-servers.ch with SMTP; 17 Jul 2001 07:37:09 -0000 Date: Tue, 17 Jul 2001 09:38:12 +0200 From: Gabriel Ambuehl X-Mailer: The Bat! (v1.53bis) Educational Organization: BUZ Internet Services X-Priority: 3 (Normal) Message-ID: <42164917939.20010717093812@buz.ch> To: Klaus Steden Cc: questions@freebsd.org Subject: Re[2]: popen() with bidirectional pipes? In-Reply-To: <20010716185721.C73359@cthulu.compt.com> References: <64111861237.20010716185355@buz.ch> <20010716160341.S73359@cthulu.compt.com> <194127057398.20010716230711@buz.ch> <20010716185721.C73359@cthulu.compt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG -----BEGIN PGP SIGNED MESSAGE----- Hello Klaus, Tuesday, July 17, 2001, 12:57:21 AM, you wrote: >> What about: >> Since popen() is now implemented using a bidirectional pipe, >> the >> type argument may request a bidirectional data flow. >> The type argument is a pointer to a null-terminated string >> which must be >> `r' for reading, `w' for writing, or `r+' for reading and >> writing. >> > I really hope you weren't the person to ask the question in the > first place since I spent time writing both the first reply and > this one to a question that could have been answered by R-ingTFM in > the first place. Actually I was. But I don't get why R-ing (which I've done at least 5 times) TFMan page should have helped me. The point is that the info out of the manpage didn't work for me. > However ... that said ... bi-directional pipes may exist on > FreeBSD, but they aren't a guarantee on any other *nix flavour. > Hence, my suggestion to try socketpair(), which is bi-directional > by design. Will see about it. I hope my Advanced Unix Programming arrives today... > If the author intends to port outside FreeBSD, then he's stuck > using either socketpair() or a pair of pipe() calls. Will see what fits my purpose better. Basically I just need to send data to stdin of the child (been thinking about kicking this and limit passing of parameter to command line options, then popen() would do the job) and read data from its stdout. Might think about providing a custom popen() to use two pipes in first place which could be a good idea anyway as it would allow to get rid of the call to sh which I really don't see much need for in my app. For the time being, FreeBSD is THE OS it has to run on, any ports will *perhaps* take place in a few weeks / months (at the moment, this is an in house project and as Unix platform we only use FreeBSD). Best regards, Gabriel ömömä -----BEGIN PGP SIGNATURE----- Version: PGP 6.5i iQEVAwUBO1PdWMZa2WpymlDxAQFHHggAwxMrhrFJa3geCYCcInz+pA2veZXGT8sL 6IQLOLSHRsPooJXEdjZLrMRePdFvhgGqWfkRigZ4jWbbo9+kMn+ik+IK2gFtwf0M XZOLP5LtN8y4UXxsHNpA9hZyNJ4ogDeZkkSlBUn6oZm8HPHY8es2eJVhTD02IMSb p9/f76mmhVdXEIzHs0kpOOLgq5yJ4F5gGpPSWp9HeVh04AhQuCkhnP0qSUtv2tSX Rhrtg9hkVHFSQI/CKJNKY5AlUwt9uTieQyiZTXzi5YruSUU093s/oBulZE2xM3c0 p64jpXIIt8sjbBUhIv9QCLHZ4jtbchSXNuX67GO9EBxKIbcIWLW5Sw== =br7M -----END PGP SIGNATURE----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message