diff --git a/src/tools/mdbx_chk.c b/src/tools/mdbx_chk.c index ea05eeca..e86fd44e 100644 --- a/src/tools/mdbx_chk.c +++ b/src/tools/mdbx_chk.c @@ -930,17 +930,23 @@ int main(int argc, char *argv[]) { dbi_main.name = "@MAIN"; atexit(pagemap_cleanup); - if (argc < 2) { + if (argc < 2) usage(prog); - } for (int i; (i = getopt(argc, argv, "Vvqnwcdsi:")) != EOF;) { switch (i) { case 'V': - printf("%s (%s, build %s)\n", mdbx_version.git.describe, - mdbx_version.git.datetime, mdbx_build.datetime); - exit(EXIT_SUCCESS); - break; + printf("mdbx_chk version %d.%d.%d.%d\n" + " - source: %s %s, commit %s, tree %s\n" + " - build: %s for %s by %s\n" + " - flags: %s\n" + " - options: %s\n", + mdbx_version.major, mdbx_version.minor, mdbx_version.release, + mdbx_version.revision, mdbx_version.git.describe, + mdbx_version.git.datetime, mdbx_version.git.commit, + mdbx_version.git.tree, mdbx_build.datetime, mdbx_build.target, + mdbx_build.compiler, mdbx_build.flags, mdbx_build.options); + return EXIT_SUCCESS; case 'v': verbose++; break; @@ -989,7 +995,9 @@ int main(int argc, char *argv[]) { #endif /* !WINDOWS */ envname = argv[optind]; - print("Running mdbx_chk for %s in 'read-%s' mode...\n", envname, + print("mdbx_chk %s (%s, T-%s)\nRunning for %s in 'read-%s' mode...\n", + mdbx_version.git.describe, mdbx_version.git.datetime, + mdbx_version.git.tree, envname, (envflags & MDBX_RDONLY) ? "only" : "write"); fflush(NULL); diff --git a/src/tools/mdbx_copy.c b/src/tools/mdbx_copy.c index d2ab3698..4e1b88ce 100644 --- a/src/tools/mdbx_copy.c +++ b/src/tools/mdbx_copy.c @@ -56,9 +56,17 @@ int main(int argc, char *argv[]) { else if (argv[1][1] == 'c' && argv[1][2] == '\0') cpflags |= MDBX_CP_COMPACT; else if (argv[1][1] == 'V' && argv[1][2] == '\0') { - printf("%s (%s, build %s)\n", mdbx_version.git.describe, - mdbx_version.git.datetime, mdbx_build.datetime); - exit(EXIT_SUCCESS); + printf("mdbx_copy version %d.%d.%d.%d\n" + " - source: %s %s, commit %s, tree %s\n" + " - build: %s for %s by %s\n" + " - flags: %s\n" + " - options: %s\n", + mdbx_version.major, mdbx_version.minor, mdbx_version.release, + mdbx_version.revision, mdbx_version.git.describe, + mdbx_version.git.datetime, mdbx_version.git.commit, + mdbx_version.git.tree, mdbx_build.datetime, mdbx_build.target, + mdbx_build.compiler, mdbx_build.flags, mdbx_build.options); + return EXIT_SUCCESS; } else argc = 0; } @@ -81,6 +89,11 @@ int main(int argc, char *argv[]) { signal(SIGTERM, signal_handler); #endif /* !WINDOWS */ + printf("mdbx_copy %s (%s, T-%s)\nRunning for copy %s to %s...\n", + mdbx_version.git.describe, mdbx_version.git.datetime, + mdbx_version.git.tree, argv[1], (argc == 2) ? "stdout" : argv[2]); + fflush(NULL); + act = "opening environment"; rc = mdbx_env_create(&env); if (rc == MDBX_SUCCESS) { diff --git a/src/tools/mdbx_dump.c b/src/tools/mdbx_dump.c index 38dc6299..ccc37356 100644 --- a/src/tools/mdbx_dump.c +++ b/src/tools/mdbx_dump.c @@ -175,9 +175,8 @@ int main(int argc, char *argv[]) { char *subname = NULL; int alldbs = 0, envflags = 0, list = 0; - if (argc < 2) { + if (argc < 2) usage(prog); - } /* -a: dump main DB and all subDBs * -s: dump only the named subDB @@ -190,10 +189,17 @@ int main(int argc, char *argv[]) { while ((i = getopt(argc, argv, "af:lnps:V")) != EOF) { switch (i) { case 'V': - printf("%s (%s, build %s)\n", mdbx_version.git.describe, - mdbx_version.git.datetime, mdbx_build.datetime); - exit(EXIT_SUCCESS); - break; + printf("mdbx_dump version %d.%d.%d.%d\n" + " - source: %s %s, commit %s, tree %s\n" + " - build: %s for %s by %s\n" + " - flags: %s\n" + " - options: %s\n", + mdbx_version.major, mdbx_version.minor, mdbx_version.release, + mdbx_version.revision, mdbx_version.git.describe, + mdbx_version.git.datetime, mdbx_version.git.commit, + mdbx_version.git.tree, mdbx_build.datetime, mdbx_build.target, + mdbx_build.compiler, mdbx_build.flags, mdbx_build.options); + return EXIT_SUCCESS; case 'l': list = 1; /*FALLTHROUGH*/; @@ -243,6 +249,11 @@ int main(int argc, char *argv[]) { #endif /* !WINDOWS */ envname = argv[optind]; + printf("mdbx_dump %s (%s, T-%s)\nRunning for %s...\n", + mdbx_version.git.describe, mdbx_version.git.datetime, + mdbx_version.git.tree, envname); + fflush(NULL); + rc = mdbx_env_create(&env); if (rc) { fprintf(stderr, "mdbx_env_create failed, error %d %s\n", rc, diff --git a/src/tools/mdbx_load.c b/src/tools/mdbx_load.c index 1d346ca9..86dce66e 100644 --- a/src/tools/mdbx_load.c +++ b/src/tools/mdbx_load.c @@ -344,10 +344,17 @@ int main(int argc, char *argv[]) { while ((i = getopt(argc, argv, "af:ns:NTV")) != EOF) { switch (i) { case 'V': - printf("%s (%s, build %s)\n", mdbx_version.git.describe, - mdbx_version.git.datetime, mdbx_build.datetime); - exit(EXIT_SUCCESS); - break; + printf("mdbx_load version %d.%d.%d.%d\n" + " - source: %s %s, commit %s, tree %s\n" + " - build: %s for %s by %s\n" + " - flags: %s\n" + " - options: %s\n", + mdbx_version.major, mdbx_version.minor, mdbx_version.release, + mdbx_version.revision, mdbx_version.git.describe, + mdbx_version.git.datetime, mdbx_version.git.commit, + mdbx_version.git.tree, mdbx_build.datetime, mdbx_build.target, + mdbx_build.compiler, mdbx_build.flags, mdbx_build.options); + return EXIT_SUCCESS; case 'a': append = 1; break; @@ -391,6 +398,12 @@ int main(int argc, char *argv[]) { signal(SIGTERM, signal_handler); #endif /* !WINDOWS */ + envname = argv[optind]; + printf("mdbx_load %s (%s, T-%s)\nRunning for %s...\n", + mdbx_version.git.describe, mdbx_version.git.datetime, + mdbx_version.git.tree, envname); + fflush(NULL); + dbuf.iov_len = 4096; dbuf.iov_base = mdbx_malloc(dbuf.iov_len); @@ -398,7 +411,6 @@ int main(int argc, char *argv[]) { if (!(mode & NOHDR)) readhdr(); - envname = argv[optind]; rc = mdbx_env_create(&env); if (rc) { fprintf(stderr, "mdbx_env_create failed, error %d %s\n", rc, diff --git a/src/tools/mdbx_stat.c b/src/tools/mdbx_stat.c index 7ca5ef4c..fd86d624 100644 --- a/src/tools/mdbx_stat.c +++ b/src/tools/mdbx_stat.c @@ -71,9 +71,8 @@ int main(int argc, char *argv[]) { char *subname = NULL; int alldbs = 0, envinfo = 0, envflags = 0, freinfo = 0, rdrinfo = 0; - if (argc < 2) { + if (argc < 2) usage(prog); - } /* -a: print stat of main DB and all subDBs * -s: print stat of only the named subDB @@ -87,10 +86,17 @@ int main(int argc, char *argv[]) { while ((o = getopt(argc, argv, "Vaefnrs:")) != EOF) { switch (o) { case 'V': - printf("%s (%s, build %s)\n", mdbx_version.git.describe, - mdbx_version.git.datetime, mdbx_build.datetime); - exit(EXIT_SUCCESS); - break; + printf("mdbx_stat version %d.%d.%d.%d\n" + " - source: %s %s, commit %s, tree %s\n" + " - build: %s for %s by %s\n" + " - flags: %s\n" + " - options: %s\n", + mdbx_version.major, mdbx_version.minor, mdbx_version.release, + mdbx_version.revision, mdbx_version.git.describe, + mdbx_version.git.datetime, mdbx_version.git.commit, + mdbx_version.git.tree, mdbx_build.datetime, mdbx_build.target, + mdbx_build.compiler, mdbx_build.flags, mdbx_build.options); + return EXIT_SUCCESS; case 'a': if (subname) usage(prog); @@ -135,6 +141,12 @@ int main(int argc, char *argv[]) { #endif /* !WINDOWS */ envname = argv[optind]; + envname = argv[optind]; + printf("mdbx_stat %s (%s, T-%s)\nRunning for %s...\n", + mdbx_version.git.describe, mdbx_version.git.datetime, + mdbx_version.git.tree, envname); + fflush(NULL); + rc = mdbx_env_create(&env); if (rc) { fprintf(stderr, "mdbx_env_create failed, error %d %s\n", rc, @@ -142,9 +154,8 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - if (alldbs || subname) { + if (alldbs || subname) mdbx_env_set_maxdbs(env, 4); - } rc = mdbx_env_open(env, envname, envflags | MDBX_RDONLY, 0664); if (rc) {