On Wed, Jan 01, 2003 at 06:00:39PM -0800, Greg Shenaut wrote: > In message <[EMAIL PROTECTED]>, Chuck Robey cleopede: > >On Thu, 2 Jan 2003, Matthew West wrote: > > > >> On Wed, Jan 01, 2003 at 01:51:57PM -0800, Tim Kientzle wrote: > >> > I'm trying to figure out how to read and use /etc/rc.conf > >> > configuration variables from within a C program. > > One off the wall way: > > #!/bin/sh > > set -a > . /etc/rc.conf > exec /your/program
Err.. If the original poster wants *all* the variables controlling the
system startup, and not just those modified by the /etc/rc.conf file,
then maybe something like the following snippet from /etc/rc would be a
better choice:
# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
This way you get the additional benefit of reading variables from other
files besides /etc/rc.conf, like e.g. /etc/rc.conf.local; without this,
you might miss important configudation data in some setups.
G'luck,
Peter
--
Peter Pentchev [EMAIL PROTECTED] [EMAIL PROTECTED]
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
I had to translate this sentence into English because I could not read the original
Sanskrit.
msg38931/pgp00000.pgp
Description: PGP signature

