Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 Jan 2003 19:52:02 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        kientzle@acm.org
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Reading rc.conf from C programs?
Message-ID:  <20030102.195202.80212471.imp@bsdimp.com>
In-Reply-To: <3E1362FD.6070001@acm.org>
References:  <3E1362FD.6070001@acm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <3E1362FD.6070001@acm.org>
            Tim Kientzle <kientzle@acm.org> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030102.195202.80212471.imp>