#include #include #include #include static void hexdump(Dbt *d) { unsigned char *cp = (unsigned char *) d->get_data(); int n = d->get_size(); printf(" "); for (int i=0; iget(&key, &val, DB_NEXT); if (r != 0) break; // printf("%.*s\n", key.get_size(), (char *)key.get_data()); hexdump(&key); // printf("%.*s\n", val.get_size(), (char *)val.get_data()); hexdump(&val); } if (key.get_data()) toku_free(key.get_data()); if (val.get_data()) toku_free(val.get_data()); r = cursor->close(); assert(r == 0); r = db.close(0); assert(r == 0); #if defined(USE_ENV) && USE_ENV r = env.close(0); assert(r == 0); #endif return 0; } static int usage() { printf("db_dump [-s DBNAME] DBFILE\n"); return 1; } int main(int argc, char *argv[]) { char *dbname = 0; int i; for (i=1; i= argc) return usage(); dbname = argv[++i]; continue; } break; } if (i >= argc) return usage(); return dbdump(argv[i], dbname); }