[Turn on line numbering]
arg hostname;
var c, line, result;
if (!hostname)
return pass();
if (hostname != "localhost" && !match_regexp(hostname, valid_host_regexp))
throw(~address, "Invalid Internet Address: \"" + hostname + "\"");
if (!async)
return pass(hostname);
if (!valid(connection)) {
if (!.restart())
return pass(hostname);
}
connection = connection.write(task_id() + ":R:" + hostname);
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"]