/* 
   qrblcheck is basically rblcheck 1.4 with a chunk of code tacked on that
   will extract the ip address of the last relay mail server from a message 
   input on stdin -- handy for use in a .qmail file
   
   The level of blocking desired is specified as the only command line 
   argument and should be 16 or higher (no checks made), 8 (RBL only), 
   4 (RBL and DUL), 2 (RBL, DUL and RSS), 1 (RBL, DUL, RSS, and ORBS 
   outputs) or 0 (all + ORBS relays). Obviously, more will be blocked 
   the lower number you use, with 0 blocking a lot of mail, both spam and
   legit.
   
   qrblcheck will return 0 if no matches were made at the specified level
   or 100 if a match is made at the specified level. A return code of 100
   tells qmail that delivery failed with a hard error. The message will be
   returned. For safety's sake, if no IP address is matched, qrblcheck will
   return 0. While not perfect, it's better than dropping mail just 
   because I couldn't forsee all the different ways IPs would present
   themselves in headers. Comments welcome.
   
   rblcheck 1.4 is Copyright (C) 1997, 1998 Edward S. Marshall

   rblcheck's main() was renamed to rblmain(), and my main() was added
   in it's place. rblmain() was modified some to handle multiple lists
   a bit differently.
   
   2000/11/21 -- .93: cleaned up some code
   
   2000/11/03 -- .92: cleaned up some code
   
   2000/11/03 -- .91: whoops, first version had a nasty bug. poor
                  memory handling on my part.

   2000/10/31 -- .9: first version. Not as clean as I want, but it'll do
                     problem: could match invalid IPs

   

   If you have problems compiling try including the resolv library on the 
   gcc command line, like so:

          gcc -o qrblcheck -lresolv qrblcheck.c
*/
