/* mdb_dump.c - memory-mapped database dump tool */
/*
- * Copyright 2011-2014 Howard Chu, Symas Corp.
+ * Copyright 2011-2018 Howard Chu, Symas Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <signal.h>
#include "lmdb.h"
+#ifdef _WIN32
+#define Z "I"
+#else
+#define Z "z"
+#endif
+
#define PRINT 1
static int mode;
if (name)
printf("database=%s\n", name);
printf("type=btree\n");
- printf("mapsize=%zu\n", info.me_mapsize);
+ printf("mapsize=%" Z "u\n", info.me_mapsize);
if (info.me_mapaddr)
printf("mapaddr=%p\n", info.me_mapaddr);
printf("maxreaders=%u\n", info.me_maxreaders);
static void usage(char *prog)
{
- fprintf(stderr, "usage: %s dbpath [-V] [-f output] [-l] [-n] [-p] [-a|-s subdb]\n", prog);
+ fprintf(stderr, "usage: %s [-V] [-f output] [-l] [-n] [-p] [-a|-s subdb] dbpath\n", prog);
exit(EXIT_FAILURE);
}
envname = argv[optind];
rc = mdb_env_create(&env);
+ if (rc) {
+ fprintf(stderr, "mdb_env_create failed, error %d %s\n", rc, mdb_strerror(rc));
+ return EXIT_FAILURE;
+ }
if (alldbs || subname) {
mdb_env_set_maxdbs(env, 2);