- if (ipf->inprogress) return; /* new article in the meantime */
- if (ipf->fd >= 0); return; /* not had EOF */
-
- if (ipf == backlog_input_file) {
- notice_processed(ipf,"backlog file",ipf->path);
- close_input_file(ipf);
- if (unlink(ipf->path)) {
- if (errno != ENOENT)
- sysdie("could not unlink processed backlog file %s", ipf->path);
- warn("backlog file %s vanished while we were reading it"
- " so we couldn't remove it (but it's done now, anyway)",
- ipf->path);
- }
- backlog_input_file= 0;
- search_backlog_file();
- return;
+static void notice_processed(InputFile *ipf, const char *what,
+ const char *spec) {
+#define RCI_NOTHING(x) /* nothing */
+#define RCI_TRIPLE_FMT(x) " " #x "=" RCI_TRIPLE_FMT_BASE
+#define RCI_TRIPLE_VALS(x) RCI_TRIPLE_VALS_BASE(ipf->counts, .x)
+
+ info("processed %s%s offered=%d(ch%d,nc%d) accepted=%d(ch%d+nc%d)"
+ RESULT_COUNTS(RCI_NOTHING, RCI_TRIPLE_FMT)
+ ,
+ what,spec,
+ ipf->counts[art_Unchecked].sent + ipf->counts[art_Unsolicited].sent
+ , ipf->counts[art_Unchecked].sent, ipf->counts[art_Unsolicited].sent,
+ ipf->counts[art_Wanted].accepted + ipf->counts[art_Unsolicited].accepted
+ ,ipf->counts[art_Wanted].accepted,ipf->counts[art_Unsolicited].accepted
+ RESULT_COUNTS(RCI_NOTHING, RCI_TRIPLE_VALS)
+ );
+}
+
+static void statemc_check_backlog_done(void) {
+ InputFile *ipf= backlog_input_file();
+ if (!inputfile_is_done(ipf)) return;
+
+ const char *slash= strrchr(ipf->path, "/");
+ const char *leaf= slash ? slash+1 : ipf->path;
+ const char *under= strchr(slash, "_");
+ const char *rest= under ? under+1 : leaf;
+ if (!strncmp(rest,"backlog",7)) rest += 7;
+ notice_processed(ipf,"backlog:",rest);
+
+ close_input_file(ipf);
+ if (unlink(ipf->path)) {
+ if (errno != ENOENT)
+ sysdie("could not unlink processed backlog file %s", ipf->path);
+ warn("backlog file %s vanished while we were reading it"
+ " so we couldn't remove it (but it's done now, anyway)",
+ ipf->path);