alarm(connection_setup_timeout);
if (NNTPconnect((char*)remote_host, port, &cn_from, &cn_to, buf) < 0) {
- if (buf[0]) fatal("connect: rejected: %s", sanitise(buf));
- else sysfatal("connect: connection attempt failed");
+ int l= strlen(buf);
+ int stripped=0;
+ while (l>0) {
+ unsigned char c= buf[l-1];
+ if (!isspace(c)) break;
+ if (c=='\n' || c=='\r') stripped=1;
+ --l;
+ }
+ if (!buf[0]) {
+ sysfatal("connect: connection attempt failed");
+ } else {
+ buf[l]= 0;
+ fatal("connect: %s: %s", stripped ? "rejected" : "failed",
+ sanitise(buf));
+ }
}
if (NNTPsendpassword((char*)remote_host, cn_from, cn_to) < 0)
sysfatal("connect: authentication failed");
{'q',"quiet-multiple", 0, &quiet_multiple, op_setint, 1 },
{0,"no-daemon", 0, &become_daemon, op_setint, 0 },
{0,"no-streaming", 0, &try_stream, op_setint, 0 },
-{0,"inndconf", "F", &inndconffile, op_string },
+{'C',"inndconf", "F", &inndconffile, op_string },
{'P',"port", "PORT", &port, op_integer },
{0,"help", 0, 0, help },
/* defaults */
+ int r= innconf_read(inndconffile);
+ if (!r) badusage("could not read inn.conf (more info on stderr)");
+
if (!remote_host) remote_host= sitename;
if (nocheck_thresh < 0 || nocheck_thresh > 100)
max_bad_data_ratio *= 0.01;
if (!feedfile) {
- innconf_read(inndconffile);
feedfile= xasprintf("%s/%s",innconf->pathoutgoing,sitename);
} else if (!feedfile[0]) {
badusage("feed filename must be nonempty");
/* let's go */
- void *r= oop_sys_run(sysloop);
- assert(r == OOP_ERROR);
+ void *run= oop_sys_run(sysloop);
+ assert(run == OOP_ERROR);
sysdie("event loop failed");
}