C code for parsing rc.conf?

Craig Rodrigues rodrigc at crodrigues.org
Fri Apr 16 04:19:47 PDT 2004


On Wed, Apr 14, 2004 at 05:14:54PM -0700, Tim Kientzle wrote:
> There was a detailed discussion of this topic about a year
> ago.  Here is how to obtain the current settings from rc.conf
> from within a C program:
> 
>  * Clear the current environment
> 
>  * popen() a shell command that sources rc.conf, then
>    runs printenv
> 
>  * read and parse the output of printenv

I like this.  Would it be worth putting a small writeup
of this in the Developer's Handbook?  Being able to
write programs which can parse and edit rc.conf
is actually quite useful in certain cases.

An analogy for this would be the API that is used
to read/write settings to the Windows registry. 

On a side note, is there any code in sysinstall
that could be reused outside of the sysinstall application
in order to parse rc.conf?

-- 
Craig Rodrigues        
http://crodrigues.org
rodrigc at crodrigues.org


More information about the freebsd-hackers mailing list