From: Stephen L Johnson Date: Thu, 24 Feb 2000 15:13:52 +0000 (+0000) Subject: host URLs were incorrect in display_html() when WWW_FQDN = 0 and restored display_nam... X-Git-Tag: spong-2_7-alpha5~69 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9659ec5478e3e86a7f8d7f635ebb7bcfb4899a73;p=spong.git host URLs were incorrect in display_html() when WWW_FQDN = 0 and restored display_name override funtionality --- diff --git a/src/lib/Spong/HostList.pm b/src/lib/Spong/HostList.pm index 3d24aaf..62a2a23 100755 --- a/src/lib/Spong/HostList.pm +++ b/src/lib/Spong/HostList.pm @@ -246,15 +246,16 @@ sub display_html { # Now go through each host, and fill in the table. foreach $host ( $self->hosts() ) { - my $hostname = $host->name(); - if ( ! $main::WWW_FQDN ) { # If WWW_FQDN not set, use short hostname - my $short = $main::HOSTS{$hostname}->{'display_name'}; - $short = (split( /\./, $hostname ))[0] unless $short; - $hostname = $short; + my $hostname = $host->name(); + # Use display-name attrib if defined + my $display = $main::HOSTS{$hostname}->{'display_name'}; + if ( ! $display ) { + # Otherwise use the hostname if $WWW_FQDN or short name + $display = $main::WWW_FQDN ? $hostname : + (split( /\./, $hostname ))[0]; } - print "\n"; - print "$hostname\n"; + print "$display\n"; foreach $service ( @names ) { my $servobj = $host->service( $service );