Hi all

I'm currently writing on a ``-thread'' switch for pick. I have
some questions about the nexus.n_action(). At the moment a action
looks the fooloing:

> int action(struct nexus  *n, FILE *fp, int msgnum, long start, long stop)

The file-pointer and the msnum is clear, but for what reason the
action needs the nexus scruct itself and what is the meaning for the
start and stop arguments?

I have looked a bit at this found that start and stop is not used.
The nexus is only to get some data for the action necesary.

An other problem I see is, that every action looks at the hole mail.
Wouldn't it be clearer if pick parses the mail and the action only
looks at the struct field.

The result would be to change the api of the action to folloing:

> int action(void *data, struct field *f, int msgnum)

Also I don't see the point of the regex implementation, because POSIX
already provides a regex implementation. This would result in a simpler
implementation for the most cases. The GREPaction could look like
this:

static int
GREPaction(void *data, struct field *f, int msgnum)
{
        struct GREPdata *d = data;
        size_t n = 0;

        if (strncasecmp(f->name, d->field, f->namelen)!=0) {
                return 0;
        }

        regexec(d->regex, f->value, &n, NULL, 0);

        return n > 0;
}

This don't work on the body, but it's not hard to write a function
for the body.

For OR and AND some bookkeeping would be necesarry. Also a free_data
function would be necesary. But all this is much simpler then a regex
implementation.

What do you think about this.

Philipp

Reply via email to