procmail
[Top] [All Lists]

Re: Get domain and tld ?

2009-01-25 19:06:24
On 25-Jan-2009, at 15:58, Dallman Ross wrote:
LuKreme wrote Sunday, January 25, 2009 22:24:
On 25-Jan-2009, at 11:21, Dallman Ross wrote:
FQDN    = $1           # for testing on the command line

Couldn't you stack this so that the rc file is usable from the
cli and from being called by another rcfile?

I want to say "sure," but frankly I have no idea what
"the cli" is.  ("Computer Luser Interface"?)  But I'll say "sure"
anyway, what the hell.

Commnd line interface. Bash, sh, tcsh, etc. It's a back formation to distinguish from a GUI.

# Check if FQDN was set
:0
* FQDN ?? ^^^^
{
  #not set, check for ARG, if it's not set, bailout
  FQDN = $1

  :0
  * FQDN ?? ^^^^
  {
    SWITCHRC
    HOST
  }
}

This way, if you SWTICHRC it works, and if you run it from
the cli it works...

Well, whatever, but I don't see why you want to run the "test-for-
empty" condition twice.  It seems like a needless complexity to me.

Because you set (or tried to set) FQDN to $1 in the meantime.

Also, simply unsetting SWITCHRC will end the rcfile.  If there are
no parent rcfiles to return to, then procmail will end and the
mail will be delivered to $DEFAULT.  That probably isn't what you
want to achieve with the above sample code.

But if you are running this from the command-line, SWITCHRC will not end processing, so you still need HOST.

I still need to know what "the cli" is.  But your understanding
of how SWITCHRC works is flawed.  The current file will not continue
if SWITCHRC is simply unset.  See "man procmailrc".

I did:
Names an rcfile (relative to the current directory) to which processing will be switched. If the named rcfile doesn't exist or is not a normal file or /dev/ null then an error will be logged ***and processing will continue in the
                   current  rcfile.***


--
Passion is the pill you can swallow forever Taking them one by one
        One by One --Agents of Good Roots "Come On"

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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