summaryrefslogtreecommitdiffstats
path: root/tools/h5diff/h5diff_common.c
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2010-09-16 21:57:27 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2010-09-16 21:57:27 (GMT)
commit6d97ffcc6cec0c23e718da16fcf0f2043df046c5 (patch)
tree7af1ae3242cdaa989f4813ef1a00d6c91aa8ccb7 /tools/h5diff/h5diff_common.c
parent6cb4260eff978e7dcbbd8014f1188dfd02550779 (diff)
downloadhdf5-6d97ffcc6cec0c23e718da16fcf0f2043df046c5.zip
hdf5-6d97ffcc6cec0c23e718da16fcf0f2043df046c5.tar.gz
hdf5-6d97ffcc6cec0c23e718da16fcf0f2043df046c5.tar.bz2
[svn-r19407] Purpose:
Add --exclude-path option Description: Merged from hdf5 trunk (r19406). 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
Diffstat (limited to 'tools/h5diff/h5diff_common.c')
-rw-r--r--tools/h5diff/h5diff_common.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index 909d2e2..739cc18 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;