So far, it sounds like noone has actually implemented a completely robust way to read rc.conf data into a shell program, although a lot of people have had good experiences with simple variable=value parsing of the raw files.
PHK's idea (use 'set' to dump the shell vars before and after sourcing rc.conf) is pretty close, but can be fooled by the following (admittedly pathalogical) example: a='b c=d' However, I had missed 'set -a'; that just might solve the problem completely, while still supporting arbitrary shell code: * Use popen() to capture the output of the following script: #!/bin/sh set -a if [ -r /etc/defaults/rc.conf ]; then . /etc/defaults/rc.conf source_rc_confs elif [ -r /etc/rc.conf ]; then . /etc/rc.conf fi my_custom_printenv * my_custom_printenv is a C program like /usr/bin/printenv, but it encodes newlines, etc, so that the text output is unambiguous (the stock printenv generates ambiguous output from examples like the one above) * capture and decode the output in the main program; discard anything that's present in the main program's environment. Can anyone see any way that this could fail? This would certainly be _much_ simpler than the approaches I had originally envisioned. Thanks for everyone's input! Tim Kientzle To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message