common options

Matthias Andree matthias.andree at gmx.de
Sat Jan 4 01:49:35 CET 2003


David Relson <relson at osagesoftware.com> writes:

> At 06:41 PM 1/2/03, Matthias Andree wrote:
>>relson at users.sourceforge.net writes:
>>
>> > Update of /cvsroot/bogofilter/bogofilter
>> > In directory sc8-pr-cvs1:/tmp/cvs-serv20420
>> >
>> > Modified Files:
>> >       Tag: mime
>> >       bogolexer.c
>> > Log Message:
>> > Add 'n' to getopt() list, so command line option '-n'
>> > (replace_nonascii_characters) will be accepted.
>>
>>Should I move the common options (nonascii, mime, ...) into a function
>>that deals with these and calls the appropriate functions or changes the
>>appropriate globals?
>>
>>Assuming we have a common header file and the same function name, that's
>>easy and should be a safe bet as long as we don't link main.o against
>>bogoutil.o.
>
> Matthias,
>
> What's the subject here?

Kill...

> Are you trying to put recognition of common options in one place?
> Certainly, bogofilter, bogolexer, and bogoutil have their own getopt()
> loops and switches and there is some code duplication within these
> loops.

...code duplication and have things in one place for simplified
maintenance.

> The code for processing each option should not be duplicated (as far as
> feasible).  "nonascii" may be an exception to the duplication rule, as
> bogofilter and bogolexer handle the replacement in the
> charset/lexer/token code but bogoutil doesn't have that code.

OK.

> When you refer to "common header file and same function name" are you
> refering to .c/.h pairs like we have for xmalloc, xstrdup, fgetsl, etc?

Yes, I am.

Any objections?

-- 
Matthias Andree




More information about the bogofilter-dev mailing list