From owner-freebsd-hackers Fri Sep 1 5:15:41 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp2.vnet.net (smtp2.vnet.net [166.82.1.32]) by hub.freebsd.org (Postfix) with ESMTP id A730837B42C for ; Fri, 1 Sep 2000 05:15:37 -0700 (PDT) Received: from dignus.com (ponds.vnet.net [166.82.177.48]) by smtp2.vnet.net (8.10.1/8.10.1) with ESMTP id e81CFO204214; Fri, 1 Sep 2000 08:15:25 -0400 (EDT) Received: from lakes.dignus.com (lakes.dignus.com [10.0.0.3]) by dignus.com (8.9.2/8.8.5) with ESMTP id IAA11771; Fri, 1 Sep 2000 08:15:23 -0400 (EDT) Received: (from rivers@localhost) by lakes.dignus.com (8.9.3/8.6.9) id IAA99159; Fri, 1 Sep 2000 08:15:22 -0400 (EDT) Date: Fri, 1 Sep 2000 08:15:22 -0400 (EDT) From: Thomas David Rivers Message-Id: <200009011215.IAA99159@lakes.dignus.com> To: maret@atrada.net, roam@orbitel.bg Subject: Re: AW: Redirect stdout/stderr to syslog [OFF-TOPIC] Cc: freebsd-hackers@FreeBSD.ORG In-Reply-To: <58A002A02C5ED311812E0050044517F00D25DB@erlangen01.atrada.de> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > > -----Ursprungliche Nachricht----- > > Von: Peter Pentchev [mailto:roam@orbitel.bg] > > Gesendet: Freitag, 1. September 2000 14:00 > > > > man 1 logger > > > > pipe your stdout/stderr to logger(1), and you're all set. > > You may even > > specify a facility/level to log with. > > > > Thanks for your quick answer but I would prefer to > do it entirely in C without calling external progs. > I could think of a solution forking another child process > which does the syslog logging and redirecting stdout/stderr > of the execvped program via IPC to this child. > > But is there any easier solution? You can use popen() to start the external process (logger in this case) with the `IPC' already set up. Then, perhaps an freopen() stdin/stdout... to the pipes would be all you need. popen() is one-way though... - Dave R. - -- rivers@dignus.com Work: (919) 676-0847 Get your mainframe (370) `C' compiler at http://www.dignus.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message