From owner-freebsd-hackers Thu Jan 2 18:52:33 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0ED5D37B405 for ; Thu, 2 Jan 2003 18:52:32 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDA0143EA9 for ; Thu, 2 Jan 2003 18:52:30 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.6/8.12.3) with ESMTP id h032qR1e033196; Thu, 2 Jan 2003 19:52:27 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Thu, 02 Jan 2003 19:52:02 -0700 (MST) Message-Id: <20030102.195202.80212471.imp@bsdimp.com> To: kientzle@acm.org Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Reading rc.conf from C programs? From: "M. Warner Losh" In-Reply-To: <3E1362FD.6070001@acm.org> References: <3E1362FD.6070001@acm.org> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: <3E1362FD.6070001@acm.org> Tim Kientzle writes: : I'm trying to figure out how to read and use : /etc/rc.conf configuration variables from within : a C program. The standard technique, of course, : is to use a shell-script wrapper and pass the : extracted values to the C program on the command : line. But I want access to _all_ of the rc.conf : variables, not just a couple of them, and I don't : see any reasonable way to accomplish that with a : shell wrapper. The easy way to do this would be to exec a small shell script that execs /etc/rc.conf, et al, then execs your program. Then it is as simple as getenv... Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message