Date: Wed, 1 Jan 2003 18:24:40 -0500 (EST) From: Chuck Robey <chuckr@chuckr.org> To: Matthew West <mwest@uct.ac.za> Cc: Tim Kientzle <kientzle@acm.org>, <freebsd-hackers@FreeBSD.ORG> Subject: Re: Reading rc.conf from C programs? Message-ID: <20030101181840.P29988-100000@april.chuckr.org> In-Reply-To: <20030102012042.A16965@apotheosis.org.za>
next in thread | previous in thread | raw e-mail | index | archive | help
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. > > You could perhaps copy the way that "The Fish" does it? > > Take a look at "ports/sysutils/thefish". > > The "parser.c" code appears to read /etc/{,defaults/}rc.conf and place > all the options into a linked list. If I had full control over a system, I'd write me lex script for it, that's easily the best way to parse args. Flexible as hell, really easy to extend, easy to special-case, easy to error-control. Learning lex is harder than just C code, but it's such a good tool to know just for general purposes, it's worth the small time spent. Every C programmer ought to spend some time with lex/flex (and obviously yacc/bison). If you don't know it for an employer, you're really hobbled, it's *such* a good tool. > > ---------------------------------------------------------------------------- Chuck Robey | Interests include C & Java programming, FreeBSD, chuckr@chuckr.org | electronics, communications, and SF/Fantasy. New Year's Resolution: I will not sphroxify gullible people into looking up fictitious words in the dictionary. ---------------------------------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030101181840.P29988-100000>