Date: Fri, 16 Apr 2004 07:19:45 -0400 From: Craig Rodrigues <rodrigc@crodrigues.org> To: Tim Kientzle <tim@kientzle.com> Cc: freebsd-hackers@freebsd.org Subject: Re: C code for parsing rc.conf? Message-ID: <20040416111945.GA23290@crodrigues.org> In-Reply-To: <407DD3FE.5010303@kientzle.com> References: <20040414215601.GA3923@crodrigues.org> <407DD3FE.5010303@kientzle.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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@crodrigues.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040416111945.GA23290>