|
|
|
@ -11,10 +11,22 @@ |
|
|
|
|
* top-level directory of the distribution or, alternatively, at |
|
|
|
|
* <http://www.OpenLDAP.org/license.html>.
|
|
|
|
|
*/ |
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
#include <windows.h> |
|
|
|
|
#define MDB_STDOUT GetStdHandle(STD_OUTPUT_HANDLE) |
|
|
|
|
#else |
|
|
|
|
#define MDB_STDOUT 1 |
|
|
|
|
#endif |
|
|
|
|
#include <stdio.h> |
|
|
|
|
#include <stdlib.h> |
|
|
|
|
#include <signal.h> |
|
|
|
|
#include "lmdb.h" |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
sighandle(int sig) |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int main(int argc,char * argv[]) |
|
|
|
|
{ |
|
|
|
|
int rc; |
|
|
|
@ -26,6 +38,15 @@ int main(int argc,char * argv[]) |
|
|
|
|
exit(EXIT_FAILURE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef SIGPIPE |
|
|
|
|
signal(SIGPIPE, sighandle); |
|
|
|
|
#endif |
|
|
|
|
#ifdef SIGHUP |
|
|
|
|
signal(SIGHUP, sighandle); |
|
|
|
|
#endif |
|
|
|
|
signal(SIGINT, sighandle); |
|
|
|
|
signal(SIGTERM, sighandle); |
|
|
|
|
|
|
|
|
|
rc = mdb_env_create(&env); |
|
|
|
|
|
|
|
|
|
rc = mdb_env_open(env, envname, MDB_RDONLY, 0); |
|
|
|
@ -33,7 +54,7 @@ int main(int argc,char * argv[]) |
|
|
|
|
printf("mdb_env_open failed, error %d %s\n", rc, mdb_strerror(rc)); |
|
|
|
|
} else { |
|
|
|
|
if (argc == 2) |
|
|
|
|
rc = mdb_env_copyfd(env, 1); |
|
|
|
|
rc = mdb_env_copyfd(env, MDB_STDOUT); |
|
|
|
|
else |
|
|
|
|
rc = mdb_env_copy(env, argv[2]); |
|
|
|
|
if (rc) |
|
|
|
|