![]() |
![]() |
ahost DNS lookup |
||||
Usage |
||||
ahost [-i] [-a] (<dnsquery:string>[,<magicdata:variant>]){ <callback command> } |
||||
Description |
||||
Starts a DNS lookup for the <dnsquery> and reports the
results by calling the callback routine.
The -i switch causes the command to execute
in IPv6 mode (and lookup ONLY IPv6 hosts!). The -a switch causes the command to run in "unspecified" mode and return any available address: IPv4 or Ipv6. This command also performs reverse lookups (if you pass an IP address as <hostname>). The callback command gets passed five parameters: $0 contains the query string (<dnsquery> in fact) $1 contains the value 1 if the query was succesfull. In that case the remaining parameters are set as follows: $2 contains the first IP address associated to the <dnsquery> $3 contains the hostname associated to the <dnsquery> $4 contains the eventual <magicdata> passed. If $1 contains the value 0 then the query has failed and $2 contains an error message explaining the failure. $3 is empty $4 contains the eventual <magicdata> passed. Please note that if the DNS query fails to even start for some reason then your callback MAY be called even before ahost() returns. |
||||
Switches |
||||
|
||||
Examples |
||||
ahost("localhost")
{
echo "Lookup: "$0;
if($1)
{
echo "IP address: "$2;
echo "Hostname: "$3;
} else {
echo "Error: $2";
}
}
ahost -i ("irc.flashnet.it","Hello :)")
{
echo "Lookup: "$0;
echo "Magic: $3";
if($1)
{
echo "IP address: "$2;
echo "Hostname: "$3;
} else {
echo "Error: $2";
}
}
ahost -a ("cafe:babe::dead:beef")
{
echo "Lookup: "$0;
echo "Magic: $3";
if($1)
{
echo "IP address: "$2;
echo "Hostname: "$3;
} else {
echo "Error: $2";
}
}
|
||||
See also |
||||
host |