diff options
author | Jonathan Kim <jkm@hdfgroup.org> | 2010-09-16 21:46:16 (GMT) |
---|---|---|
committer | Jonathan Kim <jkm@hdfgroup.org> | 2010-09-16 21:46:16 (GMT) |
commit | eb7b5b2ceffb9bed00959c4131ce9cfed09628c4 (patch) | |
tree | db0f10ded30b447a2f2900628e3457455f06976f /tools/h5diff/h5diff_common.c | |
parent | 4bae291b1f0f4d6a51f24d18bc68e4c4475498b5 (diff) | |
download | hdf5-eb7b5b2ceffb9bed00959c4131ce9cfed09628c4.zip hdf5-eb7b5b2ceffb9bed00959c4131ce9cfed09628c4.tar.gz hdf5-eb7b5b2ceffb9bed00959c4131ce9cfed09628c4.tar.bz2 |
[svn-r19406] Purpose:
Add --exclude-path option
Description:
Specified path to an object will be excluded from comparing the two files or two groups. If group is specified all the member objects will be excluded.
Related to "1890: h5diff excluding object for file comparison via command line"
Tested:
jam, amani and heiwa
Diffstat (limited to 'tools/h5diff/h5diff_common.c')
-rw-r--r-- | tools/h5diff/h5diff_common.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index b897a7f..a678b2f 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -42,6 +42,7 @@ static struct long_options l_opts[] = { { "use-system-epsilon", no_arg, 'e' }, { "follow-symlinks", no_arg, 'l' }, { "no-dangling-links", no_arg, 'x' }, + { "exclude-path", require_arg, 'E' }, { NULL, 0, '\0' } }; @@ -64,6 +65,7 @@ void parse_command_line(int argc, { int opt; + struct exclude_path_list *exclude_head, *exclude_prev, *exclude_node; /* process the command-line */ memset(options, 0, sizeof (diff_opt_t)); @@ -74,6 +76,9 @@ void parse_command_line(int argc, /* NaNs are handled by default */ options->do_nans = 1; + /* init for exclude-path option */ + exclude_head = NULL; + /* parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { @@ -104,6 +109,35 @@ void parse_command_line(int argc, case 'x': options->no_dangle_links = 1; break; + case 'E': + options->exclude_path = 1; + + /* create linked list of excluding objects */ + if( (exclude_node = (struct exclude_path_list*) malloc(sizeof(struct exclude_path_list))) == NULL) + { + printf("Error: lack of memory!\n"); + h5diff_exit(EXIT_FAILURE); + } + + /* init */ + exclude_node->obj_path = opt_arg; + exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN; + exclude_prev = exclude_head; + + if (NULL == exclude_head) + { + exclude_head = exclude_node; + exclude_head->next = NULL; + } + else + { + while(NULL != exclude_prev->next) + exclude_prev=exclude_prev->next; + + exclude_node->next = NULL; + exclude_prev->next = exclude_node; + } + break; case 'd': options->d=1; @@ -163,6 +197,10 @@ void parse_command_line(int argc, } } + /* if exclude-path option is used, keep the exclude path list */ + if (options->exclude_path) + options->exclude = exclude_head; + /* if use system epsilon, unset -p and -d option */ if (options->use_system_epsilon) options->d = options->p = 0; |