diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5diff/h5diff_common.c | 32 | ||||
-rw-r--r-- | tools/h5diff/h5diff_common.h | 2 | ||||
-rw-r--r-- | tools/h5diff/h5diff_main.c | 36 |
3 files changed, 32 insertions, 38 deletions
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index a698921..5a59215 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -55,12 +55,21 @@ static struct long_options l_opts[] = { void parse_command_line(int argc, const char* argv[], + const char** fname1, + const char** fname2, + const char** objname1, + const char** objname2, diff_opt_t* options) { int opt; - + /* process the command-line */ + memset(options, 0, sizeof (diff_opt_t)); + + /* assume equal contents initially */ + options->contents = 1; + /* parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { @@ -132,10 +141,29 @@ void parse_command_line(int argc, h5diff_exit(EXIT_FAILURE); } - + *fname1 = argv[ opt_ind ]; + *fname2 = argv[ opt_ind + 1 ]; + *objname1 = argv[ opt_ind + 2 ]; + + if ( *objname1 == NULL ) + { + *objname2 = NULL; + return; + } + + if ( argv[ opt_ind + 3 ] != NULL) + { + *objname2 = argv[ opt_ind + 3 ]; + } + else + { + *objname2 = *objname1; + } + } + /*------------------------------------------------------------------------- * Function: print_info * diff --git a/tools/h5diff/h5diff_common.h b/tools/h5diff/h5diff_common.h index b5d83e2..2796bd5 100644 --- a/tools/h5diff/h5diff_common.h +++ b/tools/h5diff/h5diff_common.h @@ -17,7 +17,7 @@ extern unsigned char g_Parallel; extern int g_nTasks; void usage(void); -void parse_command_line(int argc, const char* argv[], diff_opt_t* options); +void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* options); void h5diff_exit(int status); void print_info(diff_opt_t* options); diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index 7de3c0c..822d59c 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -79,45 +79,11 @@ int main(int argc, const char *argv[]) diff_opt_t options; /*------------------------------------------------------------------------- - * initialize options - *------------------------------------------------------------------------- - */ - - /* zero defaults */ - memset(&options, 0, sizeof (diff_opt_t)); - - /* assume equal contents initially */ - options.contents = 1; - - /*------------------------------------------------------------------------- * process the command-line *------------------------------------------------------------------------- */ - parse_command_line(argc, argv, &options); - - /*------------------------------------------------------------------------- - * file and object names - *------------------------------------------------------------------------- - */ - - fname1 = argv[ opt_ind ]; - fname2 = argv[ opt_ind + 1 ]; - objname1 = argv[ opt_ind + 2 ]; - - if ( objname1 == NULL ) - { - objname2 = NULL; - } - - if ( argv[ opt_ind + 3 ] != NULL) - { - objname2 = argv[ opt_ind + 3 ]; - } - else - { - objname2 = objname1; - } + parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options); /*------------------------------------------------------------------------- * do the diff |