Skip to content
Snippets Groups Projects
Commit eb90f16c authored by rswindell's avatar rswindell
Browse files

Use log() for output with a tx-log-level of "Debug" and an rx-log-level of

"Info".
Return 0 (success) if we get an "ok" response from the server (new), 1 (error)
otherwise.
parent bc75d7c4
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,8 @@
// usage: ?dyndns <password> [ip_address] [-mx address]
const REVISION = "$Revision$".split(' ')[1];
const rx_log_level = LOG_INFO;
const tx_log_level = LOG_DEBUG;
printf("Synchronet Dynamic DNS Client %s\r\n", REVISION);
......@@ -15,7 +17,7 @@ host_list=["dyndns.synchro.net", "rob.synchro.net", "bbs.synchro.net", "cvs.sync
function writeln(str)
{
sock.send(str + "\r\n");
print(str);
log(tx_log_level, "TX: " + str);
}
var options=load({}, "modopts.js", "dyndns");
......@@ -45,7 +47,7 @@ for(i=1;i<argc;i++) {
}
for(h in host_list) {
sock = new Socket();
if( (this.server != undefined) &&
......@@ -64,7 +66,7 @@ for(h in host_list) {
str=sock.readline();
if(str == null)
break;
print(str);
log(rx_log_level, "RX: " + str);
switch(str) {
case "id?":
writeln(host_name);
......@@ -90,6 +92,9 @@ for(h in host_list) {
else
writeln("");
break;
case "ok":
exit(0);
break;
default:
writeln("");
break;
......@@ -97,3 +102,4 @@ for(h in host_list) {
}
break;
}
exit(1);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment