[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] nmh internals: argument processing
From: |
Ralph Corderoy |
Subject: |
Re: [Nmh-workers] nmh internals: argument processing |
Date: |
Tue, 08 Jan 2013 00:54:43 +0000 |
Hi Ken,
> It occurs to me that it would be simple to add an extra element to the
> struct swit that included the value to return, so these things could
> be automatically indexed via enum (or whatever). In other words, the
> above code would convert to:
>
> enum { AUDSW, NAUDSW, CHGSW, NCHGSW, };
> static struct swit switches[] = {
> { "audit audit-file", 0, AUDSW },
> { "noaudit", 0, NAUDSW},
> { "changecur", 0, CHGSW },
> { "nochangecur", 0, NCHGSW },
>
> And the rest of the code would work normally. Thoughts?
If the new struct member is always going to run from 0 without gaps, I
assume so since the current return value is an index into switches, then
it needn't be there? Continue to return the index. Then just have the
enum instead of the #defines to remove the need to maintain the values.
(Though with vim's Ctrl-A in normal, AKA command, mode I don't find it
much of a pain.)
Cheers, Ralph.
- [Nmh-workers] nmh internals: argument processing, Ken Hornstein, 2013/01/07
- Re: [Nmh-workers] nmh internals: argument processing, Lyndon Nerenberg, 2013/01/07
- Re: [Nmh-workers] nmh internals: argument processing,
Ralph Corderoy <=
- Re: [Nmh-workers] nmh internals: argument processing, Ken Hornstein, 2013/01/07
- Re: [Nmh-workers] nmh internals: argument processing, Ralph Corderoy, 2013/01/08
- Re: [Nmh-workers] nmh internals: argument processing, Paul Fox, 2013/01/08
- Re: [Nmh-workers] nmh internals: argument processing, Ken Hornstein, 2013/01/08
- Re: [Nmh-workers] nmh internals: argument processing, Ralph Corderoy, 2013/01/08
- Re: [Nmh-workers] nmh internals: argument processing, Ken Hornstein, 2013/01/08
- Re: [Nmh-workers] nmh internals: argument processing, Ralph Corderoy, 2013/01/09
- Re: [Nmh-workers] nmh internals: argument processing, Ken Hornstein, 2013/01/09
- Re: [Nmh-workers] nmh internals: argument processing, Paul Fox, 2013/01/09
- Re: [Nmh-workers] nmh internals: argument processing, Ralph Corderoy, 2013/01/09