1 /* mdb_copy.c - memory-mapped database backup tool */
3 * Copyright 2012 Howard Chu, Symas Corp.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted only as authorized by the OpenLDAP
10 * A copy of this license is available in the file LICENSE in the
11 * top-level directory of the distribution or, alternatively, at
12 * <http://www.OpenLDAP.org/license.html>.
18 int main(int argc,char * argv[])
22 char *envname = argv[1];
25 fprintf(stderr, "usage: %s srcpath dstpath\n", argv[0]);
29 rc = mdb_env_create(&env);
31 rc = mdb_env_open(env, envname, MDB_RDONLY, 0);
33 printf("mdb_env_open failed, error %d %s\n", rc, mdb_strerror(rc));
35 rc = mdb_env_copy(env, argv[2]);
37 printf("mdb_env_copy failed, error %d %s\n", rc, mdb_strerror(rc));
41 return rc ? EXIT_FAILURE : EXIT_SUCCESS;