}
+// Convert a "usetable" record to a record on disk.
+int convert_usetable(char *line, DBT *out_key, DBT *out_data) {
+ char *token;
+ struct UseTable *u = malloc(sizeof(struct UseTable));
+
+ memset(u, 0, sizeof(struct UseTable));
+ char *p = line;
+
+ for (int i=0; (token = strsep(&p, "|")); ++i) {
+ switch(i) {
+ case 1:
+ u->hash = atoi(token);
+ break;
+ case 2:
+ u->timestamp = atol(token);
+ break;
+ }
+ }
+
+ // the key is just an int (the hash)
+ out_key->size = sizeof(int);
+ out_key->data = reallok(NULL, out_key->size);
+ memcpy(out_key->data, &u->hash, out_key->size);
+
+ out_data->size = sizeof(struct UseTable);
+ out_data->data = u;
+ return(1);
+}
+
+
#if 0
// Convert a "foo" record to a record on disk.
int convert_foo(char *line, DBT *out_key, DBT *out_data) {
else if (!strcasecmp(record_type, "floor")) row_was_good = convert_floor(line, &out_key, &out_data);
else if (!strcasecmp(record_type, "msglist")) row_was_good = convert_msglist(line, &out_key, &out_data);
else if (!strcasecmp(record_type, "visit")) row_was_good = convert_visit(line, &out_key, &out_data);
- else if (!strcasecmp(record_type, "use")) row_was_good = convert_foo(line, &out_key, &out_data);
+ else if (!strcasecmp(record_type, "use")) row_was_good = convert_usetable(line, &out_key, &out_data);
else if (!strcasecmp(record_type, "bigmsg")) row_was_good = convert_foo(line, &out_key, &out_data);
else if (!strcasecmp(record_type, "config")) row_was_good = convert_foo(line, &out_key, &out_data);
else row_was_good = 0;