+ for (i = 0; i < numdbs; i++) {
+ ret = dbconns[i]->cursor(dbconns[i],
+ NULL,
+ &cursor,
+ 0); /* flags */
+
+ fd = open(filenamebase, O_CREAT | O_WRONLY | O_TRUNC, 0640);
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+ ret = cursor->c_get(cursor, &key, &data, DB_NEXT);
+ while (ret == 0) {
+ write(fd, data.data, data.size);
+ memset(&key, 0, sizeof(key));
+ memset(&data, 0, sizeof(data));
+ ret = cursor->c_get(cursor, &key, &data, DB_NEXT);
+ }
+ if (ret != DB_NOTFOUND) {
+ logthing(LOGTHING_ERROR, "Problem reading key: %s",
+ db_strerror(ret));
+ }
+
+ close(fd);
+
+ ret = cursor->c_close(cursor);
+ cursor = NULL;
+ }
+
+ return 0;