procmail
[Top] [All Lists]

RE: Get domain and tld ?

2009-01-25 17:59:12
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.

I was not trying to provide something recursive for normal use.
It's just a test harness where I can provide sample domain names
on the command line in batches.

I don't understand why one needs recursion to check ordinary
messages in production procmail rcfiles for parsing the
domain names.  But if you think there is a reason to use recursion
for such, well, sure -- write the rcfile to do that.



# 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.

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.

Maybe you didn't notice my "SHIFT = 1" near the bottom of my
code.  That wasn't a SWITCHRC.  I'm not quite sure whether you
did or didn't notice, or what use you have in mind with your suggestion.

(Anyway, "bailout" is a noun; the verb would be to "bail out,"
two words -- or just to "bail.")


As I understand it, if the file is called from another, the SWITCHRC  
will switchback.  If it was called from the cli, the SWITCHRC 

ITYM "switch back."  :-) And as long as we're doing this, it's
"to log in," not "to login."  The word "login" is a noun or an
adjective.

will log  an error, and the HOST will abort the file.

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".

Dallman

____________________________________________________________
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>