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,
[EMAIL PROTECTED]   | 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to