Date: Thu, 2 Jan 2003 15:25:01 +0100 From: Miguel Mendez <flynn@energyhq.homeip.net> To: Chuck Robey <chuckr@chuckr.org> Cc: mwest@uct.ac.za, kientzle@acm.org, freebsd-hackers@FreeBSD.ORG Subject: Re: Reading rc.conf from C programs? Message-ID: <20030102152501.64332e55.flynn@energyhq.homeip.net> In-Reply-To: <20030101181840.P29988-100000@april.chuckr.org> References: <20030102012042.A16965@apotheosis.org.za> <20030101181840.P29988-100000@april.chuckr.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 1 Jan 2003 18:24:40 -0500 (EST) Chuck Robey <chuckr@chuckr.org> wrote: Hi, Since my little baby was mentioned, I thought I'd just comment :) > > 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. I can tell you I wholeheartedly hate parser.c :) and regret having not started with lex/yacc since day 1. Since the next major release will support not only FreeBSD, but NetBSD as well, I'm redoing the parser in a more flexible way. But again, it was my first parser, and so far seems to work fine :) I've concentrated more on other aspects of the program too. Jordan has also mentioned the parsing code in sysinstall. I think we took really different approaches to the problem. thefish has no previous knowledge of what it's going to find, save for the 'exception list', that it needs to tell some variables that are set to "NO" but aren't really knobs. It should actually be able to parse /etc/make.conf happily, or any other conf file in the system. > 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. Agreed 100% You could also use embedded perl /me ducks Cheers, -- Miguel Mendez - flynn@energyhq.homeip.net GPG Public Key :: http://energyhq.homeip.net/files/pubkey.txt EnergyHQ :: http://www.energyhq.tk Of course it runs NetBSD! 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?20030102152501.64332e55.flynn>