procmail
[Top] [All Lists]

Re: Command Line Args

2002-05-28 12:25:41
James Raney <mlists(_at_)mad-seumas(_dot_)net> writes:
...
when I should have had:

filter  unix    -       n       n       -       -       pipe flags=
       user=filter
       argv=/opt/procmail/procmail -t -m
       DOMAIN=${nexthop} SENDER=${sender}
       /opt/procmail/filter.rc ${recipient}


Apparently it doesn't fly when the args are in the wrong order :)

Thanks for your help Philip; sorry I wasted your time!

Ack!  I should have seen that.  Oh well..

As a side-note, have you considered passing the domain and sender as
the first two args, then shifting them off internally?  That would
look something like:

filter  unix    -       n       n       -       -       pipe flags=
        user=filter
        argv=/opt/procmail/procmail -t -m
        /opt/procmail/filter.rc
        ${nexthop} ${sender} ${recipient}

and then in the rcfile:

        # Make sure there are enough args: should be at least three
        # We use scoring (c.f. procmailsc(5)) to perform arithmetic for us
        :0
        * 3^0
        * $ -$#^0
        {
                LOG = "Usage: procmail -m $_ domain sender recipients...
        "
                EXITCODE = 64   # EX_USAGE
                HOST            # give up processing
        }
        DOMAIN = $1
        SENDER = $2
        # Drop the first couple args so that $@ contains just the recipients
        SHIFT = 2


The advantage to doing it that way is that you can then use
procmail's uid-switching capabilities: if you put the rcfile beneath
/etc/procmailrcs/ then procmail will become the user that owns the
rcfile, something which can be quite useful in many situations.  If you
don't need to do that, then you should _not_ put the rcfile under there.
Whether the above change in usage makes sense then is up to you.


Philip Guenther
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>