summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5ls/h5ls.c24
-rwxr-xr-xtools/h5ls/testh5ls.sh10
-rw-r--r--tools/testfiles/help-1.ls1
-rw-r--r--tools/testfiles/help-2.ls1
-rw-r--r--tools/testfiles/help-3.ls1
-rw-r--r--tools/testfiles/tall-2.ls2
-rw-r--r--tools/testfiles/textlink-1.ls4
-rw-r--r--tools/testfiles/textlinksrc-1.ls2
-rw-r--r--tools/testfiles/textlinksrc-2.ls2
-rw-r--r--tools/testfiles/textlinksrc-3.ls2
-rw-r--r--tools/testfiles/textlinksrc-4.ls9
-rw-r--r--tools/testfiles/textlinksrc-5.ls4
-rw-r--r--tools/testfiles/textlinksrc-6.ls8
-rw-r--r--tools/testfiles/textlinksrc-7.ls4
-rw-r--r--tools/testfiles/tgroup-1.ls1
15 files changed, 64 insertions, 11 deletions
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 7850a59..c5ff96e 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -61,6 +61,7 @@ static hbool_t label_g = FALSE; /* label compound values? */
static hbool_t string_g = FALSE; /* print 1-byte numbers as ASCII? */
static hbool_t fullname_g = FALSE; /* print full path names */
static hbool_t recursive_g = FALSE; /* recursive descent listing */
+static hbool_t follow_elink_g = FALSE; /* follow external links */
static hbool_t grp_literal_g = FALSE; /* list group, not contents */
static hbool_t hexdump_g = FALSE; /* show data as raw hexadecimal */
static hbool_t show_errors_g = FALSE; /* print HDF5 error messages */
@@ -115,6 +116,7 @@ usage: %s [OPTIONS] [OBJECTS...]\n\
-a, --address Print addresses for raw data\n\
-d, --data Print the values of datasets\n\
-e, --errors Show all HDF5 error reporting\n\
+ -E, --external Allow traversal into external files\n\
-f, --full Print full path names instead of base names\n\
-g, --group Show information about a group, not its contents\n\
-l, --label Label members of compound datasets\n\
@@ -1906,10 +1908,14 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
if(*path != '/')
HDfputc('/', stdout);
HDfputs(path, stdout);
- HDfputs("} ", stdout);
+ HDfputc('}', stdout);
/* Recurse through the external link */
- if(recursive_g) {
+ if(follow_elink_g) {
+ hbool_t orig_grp_literal = grp_literal_g;
+
+ HDfputc(' ', stdout);
+
/* Check if we have already seen this elink */
if(elink_trav_visited(iter->elink_list, filename, path)) {
HDfputs("{Already Visited}\n", stdout);
@@ -1927,11 +1933,19 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
* target of an external link */
iter->ext_target = TRUE;
+ /* Prevent recursive listing of external link target if
+ * recursive_g is off */
+ if(!recursive_g)
+ grp_literal_g = TRUE;
+
/* Recurse through the external link */
if(visit_obj(iter->fid, name, iter) < 0) {
HDfree(buf);
+ grp_literal_g = orig_grp_literal;
goto done;
}
+
+ grp_literal_g = orig_grp_literal;
}
else
HDfputc('\n', stdout);
@@ -2174,6 +2188,8 @@ main(int argc, const char *argv[])
data_g = TRUE;
} else if(!HDstrcmp(argv[argno], "--errors")) {
show_errors_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--external")) {
+ follow_elink_g = TRUE;
} else if(!HDstrcmp(argv[argno], "--full")) {
fullname_g = TRUE;
} else if(!HDstrcmp(argv[argno], "--group")) {
@@ -2255,6 +2271,10 @@ main(int argc, const char *argv[])
show_errors_g = TRUE;
break;
+ case 'E': /* --external */
+ follow_elink_g = TRUE;
+ break;
+
case 'f': /* --full */
fullname_g = TRUE;
break;
diff --git a/tools/h5ls/testh5ls.sh b/tools/h5ls/testh5ls.sh
index 498384c..0bae60b 100755
--- a/tools/h5ls/testh5ls.sh
+++ b/tools/h5ls/testh5ls.sh
@@ -129,9 +129,13 @@ TOOLTEST tslink-1.ls 0 -w80 -r tslink.h5
# test for displaying external and user-defined links
TOOLTEST textlink-1.ls 0 -w80 -r textlink.h5
-TOOLTEST textlinksrc-1.ls 0 -w80 -r textlinksrc.h5
-TOOLTEST textlinksrc-2.ls 0 -w80 -rv textlinksrc.h5/ext_link5
-TOOLTEST textlinksrc-3.ls 0 -w80 -r textlinksrc.h5/ext_link1
+TOOLTEST textlinksrc-1.ls 0 -w80 -Er textlinksrc.h5
+TOOLTEST textlinksrc-2.ls 0 -w80 -Erv textlinksrc.h5/ext_link5
+TOOLTEST textlinksrc-3.ls 0 -w80 -Er textlinksrc.h5/ext_link1
+TOOLTEST textlinksrc-4.ls 0 -w80 -r textlinksrc.h5
+TOOLTEST textlinksrc-5.ls 0 -w80 -r textlinksrc.h5/ext_link1
+TOOLTEST textlinksrc-6.ls 0 -w80 -E textlinksrc.h5
+TOOLTEST textlinksrc-7.ls 0 -w80 -E textlinksrc.h5/ext_link1
TOOLTEST tudlink-1.ls 0 -w80 -r tudlink.h5
# tests for hard links
diff --git a/tools/testfiles/help-1.ls b/tools/testfiles/help-1.ls
index 94a9976..4c45570 100644
--- a/tools/testfiles/help-1.ls
+++ b/tools/testfiles/help-1.ls
@@ -7,6 +7,7 @@ usage: h5ls [OPTIONS] [OBJECTS...]
-a, --address Print addresses for raw data
-d, --data Print the values of datasets
-e, --errors Show all HDF5 error reporting
+ -E, --external Allow traversal into external files
-f, --full Print full path names instead of base names
-g, --group Show information about a group, not its contents
-l, --label Label members of compound datasets
diff --git a/tools/testfiles/help-2.ls b/tools/testfiles/help-2.ls
index ee7de9e..522cb5a 100644
--- a/tools/testfiles/help-2.ls
+++ b/tools/testfiles/help-2.ls
@@ -7,6 +7,7 @@ usage: h5ls [OPTIONS] [OBJECTS...]
-a, --address Print addresses for raw data
-d, --data Print the values of datasets
-e, --errors Show all HDF5 error reporting
+ -E, --external Allow traversal into external files
-f, --full Print full path names instead of base names
-g, --group Show information about a group, not its contents
-l, --label Label members of compound datasets
diff --git a/tools/testfiles/help-3.ls b/tools/testfiles/help-3.ls
index 65c0bd8..22ad865 100644
--- a/tools/testfiles/help-3.ls
+++ b/tools/testfiles/help-3.ls
@@ -7,6 +7,7 @@ usage: h5ls [OPTIONS] [OBJECTS...]
-a, --address Print addresses for raw data
-d, --data Print the values of datasets
-e, --errors Show all HDF5 error reporting
+ -E, --external Allow traversal into external files
-f, --full Print full path names instead of base names
-g, --group Show information about a group, not its contents
-l, --label Label members of compound datasets
diff --git a/tools/testfiles/tall-2.ls b/tools/testfiles/tall-2.ls
index 983f515..61b8cfb 100644
--- a/tools/testfiles/tall-2.ls
+++ b/tools/testfiles/tall-2.ls
@@ -16,7 +16,7 @@
Data:
(0) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
/g1/g1.2 Group
-/g1/g1.2/extlink External Link {somefile//somepath} {**NOT FOUND**}
+/g1/g1.2/extlink External Link {somefile//somepath}
/g1/g1.2/g1.2.1 Group
/g1/g1.2/g1.2.1/slink Soft Link {somevalue}
/g2 Group
diff --git a/tools/testfiles/textlink-1.ls b/tools/testfiles/textlink-1.ls
index aae806e..c159483 100644
--- a/tools/testfiles/textlink-1.ls
+++ b/tools/testfiles/textlink-1.ls
@@ -2,5 +2,5 @@
output for 'h5ls -w80 -r textlink.h5'
#############################
/ Group
-/extlink1 External Link {filename//objname} {**NOT FOUND**}
-/extlink2 External Link {anotherfile//anotherobj} {**NOT FOUND**}
+/extlink1 External Link {filename//objname}
+/extlink2 External Link {anotherfile//anotherobj}
diff --git a/tools/testfiles/textlinksrc-1.ls b/tools/testfiles/textlinksrc-1.ls
index 44b8948..3b0da0b 100644
--- a/tools/testfiles/textlinksrc-1.ls
+++ b/tools/testfiles/textlinksrc-1.ls
@@ -1,5 +1,5 @@
#############################
- output for 'h5ls -w80 -r textlinksrc.h5'
+ output for 'h5ls -w80 -Er textlinksrc.h5'
#############################
/ Group
/ext_link1 External Link {textlinktar.h5//group} {Group}
diff --git a/tools/testfiles/textlinksrc-2.ls b/tools/testfiles/textlinksrc-2.ls
index da40ed7..acdc3d2 100644
--- a/tools/testfiles/textlinksrc-2.ls
+++ b/tools/testfiles/textlinksrc-2.ls
@@ -1,5 +1,5 @@
#############################
- output for 'h5ls -w80 -rv textlinksrc.h5/ext_link5'
+ output for 'h5ls -w80 -Erv textlinksrc.h5/ext_link5'
#############################
Opened "textlinksrc.h5" with sec2 driver.
ext_link5 External Link {textlinktar.h5//empty_group} {Group
diff --git a/tools/testfiles/textlinksrc-3.ls b/tools/testfiles/textlinksrc-3.ls
index 91ff216..dd9d1b1 100644
--- a/tools/testfiles/textlinksrc-3.ls
+++ b/tools/testfiles/textlinksrc-3.ls
@@ -1,5 +1,5 @@
#############################
- output for 'h5ls -w80 -r textlinksrc.h5/ext_link1'
+ output for 'h5ls -w80 -Er textlinksrc.h5/ext_link1'
#############################
ext_link1 External Link {textlinktar.h5//group} {Group}
/dset Dataset {6}
diff --git a/tools/testfiles/textlinksrc-4.ls b/tools/testfiles/textlinksrc-4.ls
new file mode 100644
index 0000000..f440d9c
--- /dev/null
+++ b/tools/testfiles/textlinksrc-4.ls
@@ -0,0 +1,9 @@
+#############################
+ output for 'h5ls -w80 -r textlinksrc.h5'
+#############################
+/ Group
+/ext_link1 External Link {textlinktar.h5//group}
+/ext_link2 External Link {textlinktar.h5//dset}
+/ext_link3 External Link {textlinktar.h5//type}
+/ext_link4 External Link {textlinktar.h5//group/elink_t2}
+/ext_link5 External Link {textlinktar.h5//empty_group}
diff --git a/tools/testfiles/textlinksrc-5.ls b/tools/testfiles/textlinksrc-5.ls
new file mode 100644
index 0000000..a1d61d7
--- /dev/null
+++ b/tools/testfiles/textlinksrc-5.ls
@@ -0,0 +1,4 @@
+#############################
+ output for 'h5ls -w80 -r textlinksrc.h5/ext_link1'
+#############################
+ext_link1 External Link {textlinktar.h5//group}
diff --git a/tools/testfiles/textlinksrc-6.ls b/tools/testfiles/textlinksrc-6.ls
new file mode 100644
index 0000000..e1b8b74
--- /dev/null
+++ b/tools/testfiles/textlinksrc-6.ls
@@ -0,0 +1,8 @@
+#############################
+ output for 'h5ls -w80 -E textlinksrc.h5'
+#############################
+ext_link1 External Link {textlinktar.h5//group} {Group}
+ext_link2 External Link {textlinktar.h5//dset} {Dataset {6}}
+ext_link3 External Link {textlinktar.h5//type} {Type}
+ext_link4 External Link {textlinktar.h5//group/elink_t2} {**NOT FOUND**}
+ext_link5 External Link {textlinktar.h5//empty_group} {Group}
diff --git a/tools/testfiles/textlinksrc-7.ls b/tools/testfiles/textlinksrc-7.ls
new file mode 100644
index 0000000..9249d0c
--- /dev/null
+++ b/tools/testfiles/textlinksrc-7.ls
@@ -0,0 +1,4 @@
+#############################
+ output for 'h5ls -w80 -E textlinksrc.h5/ext_link1'
+#############################
+ext_link1 External Link {textlinktar.h5//group} {Group}
diff --git a/tools/testfiles/tgroup-1.ls b/tools/testfiles/tgroup-1.ls
index 0ca929d..5401cd7 100644
--- a/tools/testfiles/tgroup-1.ls
+++ b/tools/testfiles/tgroup-1.ls
@@ -9,6 +9,7 @@ usage: h5ls [OPTIONS] [OBJECTS...]
-a, --address Print addresses for raw data
-d, --data Print the values of datasets
-e, --errors Show all HDF5 error reporting
+ -E, --external Allow traversal into external files
-f, --full Print full path names instead of base names
-g, --group Show information about a group, not its contents
-l, --label Label members of compound datasets