Commit 59c7cfc4 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5543 make ftverify use argv[0] to name itself


git-svn-id: file:///svn/toku/tokudb@48493 c7de825b-a66e-492c-adef-691d508d4ae1
parent 7c1d2ba0
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <sysexits.h>
#include <unistd.h> #include <unistd.h>
#include "fttypes.h" #include "fttypes.h"
...@@ -356,35 +357,17 @@ check_block_table(int fd, BLOCK_TABLE bt, struct ft *h) ...@@ -356,35 +357,17 @@ check_block_table(int fd, BLOCK_TABLE bt, struct ft *h)
fflush(stdout); fflush(stdout);
} }
// Validate arguments and print usage if number of arguments is
// incorrect.
static int
check_args(int argc)
{
int r = 0;
if (argc < 3 || argc > 4) {
printf("ERROR: ");
printf("Too few arguments.\n");
printf("USAGE:\n");
printf(" verify_block_checksum");
printf(" DICTIONARY_FILE OUTPUT_FILE [PERCENTAGE]\n");
printf(" [PERCENTAGE] is optional.\n");
r = 1;
}
return r;
}
// Main diver for verify_block_checksum.
int int
main(int argc, char *argv[]) main(int argc, char const * const argv[])
{ {
// open the file // open the file
int r = 0; int r = 0;
int dictfd; int dictfd;
char *dictfname, *outfname; const char *dictfname, *outfname;
r = check_args(argc); if (argc < 3 || argc > 4) {
if (r) { fprintf(stderr, "%s: Invalid arguments.\n", argv[0]);
fprintf(stderr, "Usage: %s <dictionary> <logfile> [report%%]\n", argv[0]);
r = EX_USAGE;
goto exit; goto exit;
} }
...@@ -432,9 +415,9 @@ main(int argc, char *argv[]) ...@@ -432,9 +415,9 @@ main(int argc, char *argv[])
} }
if (h1 == NULL && h2 == NULL) { if (h1 == NULL && h2 == NULL) {
printf("Both headers have a corruption and could not be used.\n"); printf("Both headers have a corruption and could not be used.\n");
} }
toku_thread_pool_destroy(&ft_pool); toku_thread_pool_destroy(&ft_pool);
exit: exit:
return 0; return r;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment