Method code for $dns.hostname()

[Turn on line numbering]
arg ip;
var c, line, result;

if (!ip)
    return pass();
if (!match_regexp(ip, valid_ip_regexp))
    throw(~invip, "Invalid IP Address: " + ip);
if (!async)
    return pass(ip);
if (!valid(connection)) {
    if (!.restart())
        return pass(ip);
}
connection = connection.write(task_id() + ":N:" + ip);
result = $scheduler.suspend(this());
if (type(result) != 'list || listlen(result) != 2)
    return "";
switch (result[1]) {
    case "N":
        throw(~address, result[2]);
    case "F":
        throw(~failed, result[2]);
    case "G":
        return result[2];
    default:
        $sys.log("DNS ERROR: Invalid result: " + result.join(":"));
}

["// Created 01-Jul-1997 as a part of ColdCore, see: @help Credit"]

Method Ancestry Override:

 ----  172 $dns.hostname(ip)
 ---n    1 $network.hostname()

the Cold Dark