#include <string.h>
#include <ctype.h>
#include <unistd.h>
+#include <signal.h>
#include "lmdb.h"
#define PRINT 1
{ 0, NULL }
};
+static volatile sig_atomic_t gotsig;
+
+static void dumpsig( int sig )
+{
+ gotsig=1;
+}
+
static const char hexc[] = "0123456789abcdef";
static void hex(unsigned char c)
if (rc) return rc;
while ((rc = mdb_cursor_get(mc, &key, &data, MDB_NEXT) == MDB_SUCCESS)) {
+ if (gotsig) {
+ rc = EINTR;
+ break;
+ }
if (mode & PRINT) {
text(&key);
text(&data);
if (optind != argc - 1)
usage(prog);
+#ifdef SIGPIPE
+ signal(SIGPIPE, dumpsig);
+#endif
+#ifdef SIGHUP
+ signal(SIGHUP, dumpsig);
+#endif
+ signal(SIGINT, dumpsig);
+ signal(SIGTERM, dumpsig);
+
envname = argv[optind];
rc = mdb_env_create(&env);
list++;
} else {
rc = dumpit(txn, db2, str);
+ if (rc)
+ break;
}
mdb_close(env, db2);
}