Fixed "hostname" handling to cover the case where 'hostname' returns the
unqualified hostname and 'domainname' is needed to get the fully
qualified hostname.