I'll give you another 'easy' hack to contemplate.

6 == 12 * 0,5

Make your tool system('sh /etc/rc.conf');
And then use the native [get|set]env(3) functions to read/write the values you are intested in.
When you are ready to commit the process scan **environ (7) to rebuild it without the redundant stuff (and without your uid env).


I think it's much better to use the shells logic rather than parsing. There may be installations that require a little math or early reentrant shell programming to manage startup.

What ever you do _pleese_ offer automatic failback to the previous rc.conf if the system comes up sour with the generated rc. Perhaps this should be hooks to rc itself.

Has anyone used SystemStarter under FreeBSD? It can really haul a machine through the startup sequence by parallel execution of non critical startup binaries. I've seen it pull an otherwise sluggish darwin up in a big hurry.

On Apr 14, 2004, at 8:14 PM, Tim Kientzle wrote:

Craig Rodrigues wrote:
Is there a C library that comes with FreeBSD which
can be used to parse, append to, and validate
rc.conf?

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

The basic idea is to just let the shell do
the work for you.


[EMAIL PROTECTED]
System Administration Lead,
NOAA/MDL

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to