home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / NETWORK / ISP / bind.4.8.3.lzh / BIND483 / EXAMPLES / ch06.canon.perl next >
Text File  |  1994-01-09  |  365b  |  18 lines

  1. #!/usr/bin/perl
  2.  
  3. # Perl canonicalization filter
  4. #
  5. # Expects one hostname per line, in the first field (a la .rhosts,
  6. # X0.hosts)
  7.  
  8. require 'sys/socket.ph';
  9.  
  10. while(<>){
  11.     if(($hostname, $null) = split){
  12.       ($domainname, $aliases, $addrtype, $length, @addrs) =
  13.           gethostbyname($hostname);
  14.       if($domainname) {s/$hostname/$domainname/;}
  15.     }
  16.     print;
  17. }
  18.