[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
This commit is contained in:
Jonathan Kim
2010-09-16 16:46:16 -05:00
parent 4bae291b1f
commit eb7b5b2cef
17 changed files with 659 additions and 18 deletions

View File

@@ -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;