Date: Thu, 2 Jan 2003 16:20:23 -0700 From: Chad David <davidc@issci.ca> To: Miguel Mendez <flynn@energyhq.homeip.net> Cc: Chuck Robey <chuckr@chuckr.org>, mwest@uct.ac.za, kientzle@acm.org, freebsd-hackers@FreeBSD.ORG Subject: Re: Reading rc.conf from C programs? Message-ID: <20030102232023.GA86743@colnta.acns.ab.ca> In-Reply-To: <20030102152501.64332e55.flynn@energyhq.homeip.net> References: <20030102012042.A16965@apotheosis.org.za> <20030101181840.P29988-100000@april.chuckr.org> <20030102152501.64332e55.flynn@energyhq.homeip.net>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
On Thu, Jan 02, 2003 at 03:25:01PM +0100, Miguel Mendez wrote:
> 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.
Here is a very simple lex/yacc parser that reads simple key value pairs.
The whole thing took about 30 minutes to write. Exclusive states may not
be the easiest or best way to handle the parts of the sh syntax that need
to be ignored, but it was a quick way to handle the if, which was all I
cared about.
--
Chad David davidc@issci.ca
www.FreeBSD.org davidc@freebsd.org
ISSci Inc. Calgary, Alberta Canada
[-- Attachment #2 --]
>readrc.tar kSHү肸6Fy^BJ2H$'e$
[I_dMWaK36m07f\j6VAkscjmol :.As;$`wn?)Ȇy{eIR~ɶնm|Q0v4H,:jkáC:(JyÉWI|n%\`Kejn:6o2ԡgIx}A]G>z' !س4F`{ayAShRHWS4Bs!+Cbw587aF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