+void read_plaintext(FILE *fp, DatabaseReceiver *receiver)
+{
+ if (fseek(fp, 0, SEEK_SET) != 0) {
+ perror("fseek");
+ exit(1);
+ }
+
+ while (!feof(fp)) {
+ char buf[1024];
+ if (fgets(buf, sizeof(buf), fp) == nullptr) {
+ break;
+ }
+ string s(buf);
+ assert(!s.empty());
+ while (s.back() != '\n' && !feof(fp)) {
+ // The string was longer than the buffer, so read again.
+ if (fgets(buf, sizeof(buf), fp) == nullptr) {
+ break;
+ }
+ s += buf;
+ }
+ if (!s.empty() && s.back() == '\n')
+ s.pop_back();
+ receiver->add_file(move(s));
+ }
+}
+
+void read_mlocate(FILE *fp, DatabaseReceiver *receiver)