[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-hello] Does "Hello, world!" need a configuration file?

From: Bruce Korb
Subject: Re: [bug-hello] Does "Hello, world!" need a configuration file?
Date: Sat, 9 Jul 2005 20:52:31 -0700
User-agent: KMail/1.7.1

Hi Karl,

On Saturday 09 July 2005 05:06 pm, Karl Berry wrote:
> Hi Bruce,
>     configury magic needed to actually make it work.  (details....;)
> It would be very helpful if you could make a stab at defining that
> configury magic :).  At least, it's not immediately obvious to me where
> to start.

But I _hate_ autoconf.  :-)  Attached anyway.

> Also, I'd like to request a simpler change.  I don't see any purpose in
> allowing the options like --version and --help to be set in the
> configuration file.

I don't either, but it was easier than worrying about it.  The
attached patch simply ignores them.  With a little effort, it
could not look for them, too, but I leave that as an exercise for
the reader.  :)

> All that really needs to be allowed is a single 
> setting in the config file, say "greeting", which overrides the "hello,
> world" text.  Ok?

How about, "greeting" overrides just the "hello" and not the "greeted"
(world) part?

> On the other hand, I guess that might actually make it worse, since part
> of the point here is to reuse the longopts structure, right?

Naw.  I just needed to fix the loop-over-the-longopts thing to ignore
-h and -v.

> I don't 
> like duplicating that switch statement to handle all the options when
> they are not really useful.  Hmm.  I'm not sure what is best.

Two things:

1) this is only an example showing how it works.  It is not meant to
   be saying, "you have to use your longopts list."  You could, of course,
   set a counter to the value:  (sizeof(longopts)/sizeof(longopts[0]))-2
   and stop when it reaches zero.  Do you want to bother?

2) You otta be using AutoOpts anyway.  "help" and "version" are automatically
   supported and marked as not "presettable"  viz.
     export AUTOGEN_HELP=yes
   will have no effect, though:
     export AUTOGEN_TIMEOUT=180
   will work as expected.
   hello.c does not do environment variables (yet? ;)

> I've added a --greeting (-g) option to allow it from the command line.

I've tweaked it to only fiddle with the "hello" part and leave "world" alone.

Cheers - Bruce

Attachment: hello.diff
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]