+ /* dump the global preferences */
+ cursor = trackdb_opencursor(trackdb_globaldb, tid);
+ err = cursor->c_get(cursor, prepare_data(&k), prepare_data(&d),
+ DB_FIRST);
+ while(err == 0) {
+ if(fputc('G', fp) < 0
+ || urlencode(s, k.data, k.size)
+ || fputc('\n', fp) < 0
+ || urlencode(s, d.data, d.size)
+ || fputc('\n', fp) < 0)
+ fatal(errno, "error writing to %s", tag);
+ err = cursor->c_get(cursor, prepare_data(&k), prepare_data(&d),
+ DB_NEXT);
+ }
+ if(trackdb_closecursor(cursor)) { cursor = 0; goto fail; }
+ cursor = 0;
+
+ /* dump the users */
+ cursor = trackdb_opencursor(trackdb_usersdb, tid);
+ err = cursor->c_get(cursor, prepare_data(&k), prepare_data(&d),
+ DB_FIRST);
+ while(err == 0) {
+ if(fputc('U', fp) < 0
+ || urlencode(s, k.data, k.size)
+ || fputc('\n', fp) < 0
+ || urlencode(s, d.data, d.size)
+ || fputc('\n', fp) < 0)
+ fatal(errno, "error writing to %s", tag);
+ err = cursor->c_get(cursor, prepare_data(&k), prepare_data(&d),
+ DB_NEXT);
+ }
+ if(trackdb_closecursor(cursor)) { cursor = 0; goto fail; }
+ cursor = 0;
+