summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5trav.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2003-12-18 20:25:11 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2003-12-18 20:25:11 (GMT)
commit5658d883277c915fa56c111bbb21a487a0659e1f (patch)
treecce6746b89fcc35e491b58b418f8d83c7e4c2900 /tools/lib/h5trav.c
parent5b518c102d14f036116e98244fc6856a6c49dc3c (diff)
downloadhdf5-5658d883277c915fa56c111bbb21a487a0659e1f.zip
hdf5-5658d883277c915fa56c111bbb21a487a0659e1f.tar.gz
hdf5-5658d883277c915fa56c111bbb21a487a0659e1f.tar.bz2
[svn-r7971] Purpose:
h5repack bug Description: changed the copy hardlinks algorithm added more tests Solution: Platforms tested: linux solaris IRIX Misc. update:
Diffstat (limited to 'tools/lib/h5trav.c')
-rw-r--r--tools/lib/h5trav.c63
1 files changed, 60 insertions, 3 deletions
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index e065e28..a005636 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -389,11 +389,12 @@ int traverse( hid_t loc_id,
if ( table->objs[j].displayed == 0 )
{
table->objs[j].displayed = 1;
+ trav_table_addlink(table,j,path);
}
else
{
#if defined (H5_TRAV_DEBUG)
- printf("<%s> HARDLINK to <%s>\n", path, table->objs[j].name);
+ printf("<%s> HARDLINK\n", path);
#endif
trav_table_addlink(table,j,path);
}
@@ -429,11 +430,12 @@ int traverse( hid_t loc_id,
if ( table->objs[j].displayed == 0 )
{
table->objs[j].displayed = 1;
+ trav_table_addlink(table,j,path);
}
else
{
#if defined (H5_TRAV_DEBUG)
- printf("<%s> HARDLINK to <%s>\n", path, table->objs[j].name);
+ printf("<%s> HARDLINK\n", path);
#endif
trav_table_addlink(table,j,path);
} /* displayed==1 */
@@ -585,10 +587,65 @@ void h5trav_printtable(trav_table_t *table)
{
for ( j=0; j<table->objs[i].nlinks; j++)
{
- printf(" %-10s %s\n", " hardlink", table->objs[i].links[j] );
+ printf(" %-10s %s\n", " hardlink", table->objs[i].links[j].new_name );
+ }
+ }
+
+ }
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5trav_getindext
+ *
+ * Purpose: get index of NAME in list
+ *
+ * Return: index, -1 if not found
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: December 18, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int h5trav_getindext(const char *name, trav_table_t *table)
+{
+ char *pdest;
+ int result;
+ int i, j;
+
+ for ( i = 0; i < table->nobjs; i++)
+ {
+ if ( strcmp(name,table->objs[i].name)==0 )
+ return i;
+
+ pdest = strstr( table->objs[i].name, name );
+ result = (int)(pdest - table->objs[i].name);
+
+ /* found at position 1, meaning without '/' */
+ if( pdest != NULL && result==1 )
+ return i;
+
+ /* search also in the list of links */
+ if (table->objs[i].nlinks)
+ {
+ for ( j=0; j<table->objs[i].nlinks; j++)
+ {
+ if ( strcmp(name,table->objs[i].links[j].new_name)==0 )
+ return i;
+
+ pdest = strstr( table->objs[i].links[j].new_name, name );
+ result = (int)(pdest - table->objs[i].links[j].new_name);
+
+ /* found at position 1, meaning without '/' */
+ if( pdest != NULL && result==1 )
+ return i;
+
}
}
}
+ return -1;
}