Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.991 and 1.992

version 1.991, 2009/03/21 20:56:55 version 1.992, 2009/03/21 21:43:46
Line 9046  sub get_dns { Line 9046  sub get_dns {
   
  return %iphost;   return %iphost;
     }      }
 }  
   
 #      #
 #  Given a DNS returns the loncapa host name for that DNS       #  Given a DNS returns the loncapa host name for that DNS 
 #       # 
 sub host_from_dns {      sub host_from_dns {
     my ($dns) = @_;          my ($dns) = @_;
     my @hosts;          my @hosts;
     my $ip;          my $ip;
   
     $ip = gethostbyname($dns); # Initial translation to IP is in net order.          if (defined($name_to_ip{$dns})) {
     if (length($ip) == 4) {               $ip = $name_to_ip{$dns};
  $ip   = &IO::Socket::inet_ntoa($ip);          }
  @hosts = get_hosts_from_ip($ip);          if (!$ip) {
  return $hosts[0];              $ip = gethostbyname($dns); # Initial translation to IP is in net order.
               if (length($ip) == 4) { 
           $ip   = &IO::Socket::inet_ntoa($ip);
               }
           }
           if ($ip) {
       @hosts = get_hosts_from_ip($ip);
       return $hosts[0];
           }
           return undef;
     }      }
     return undef;  
 }  }
   
 BEGIN {  BEGIN {

Removed from v.1.991  
changed lines
  Added in v.1.992


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>