summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2001-02-22 19:15:01 (GMT)
committerRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2001-02-22 19:15:01 (GMT)
commite4e6daee0ccf4bd8e64a215e70c2096049877440 (patch)
treef5a63fdf17bc5f59cd4e4c809ea6ab842ca53d9d /tools
parent059190cf7969453362a22ac79a2fa9539229e378 (diff)
downloadhdf5-e4e6daee0ccf4bd8e64a215e70c2096049877440.zip
hdf5-e4e6daee0ccf4bd8e64a215e70c2096049877440.tar.gz
hdf5-e4e6daee0ccf4bd8e64a215e70c2096049877440.tar.bz2
[svn-r3484]
Purpose: fix bug in XML output Description: OBJ-XID, Parents, etc. were messed up in several cases. Solution: Fixed. Updated tests to have correct results in them Platforms tested: Solaris 2.7
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/tools/h5dump.c b/tools/h5dump.c
index 110aaf7..dab11d7 100644
--- a/tools/h5dump.c
+++ b/tools/h5dump.c
@@ -1225,7 +1225,7 @@ static herr_t
dump_all(hid_t group, const char *name, void * op_data)
{
hid_t obj;
- char *buf, *tmp;
+ char *buf, *tmp, *tmp2;
H5G_stat_t statbuf;
int i;
@@ -1254,11 +1254,22 @@ dump_all(hid_t group, const char *name, void * op_data)
printf("LINKTARGET \"%s\"\n", buf);
} else {
/* XML */
+ tmp2 = (char *) malloc(strlen(prefix) + statbuf.linklen + 2);
+ strcpy(tmp2, prefix);
+ if (buf && buf[0] == '/') {
+ strcat(tmp2, buf);
+ } else {
+ strcat(strcat(tmp2, "/"), buf);
+ }
+ strcat(strcat(tmp, "/"), name);
printf
("<SoftLink LinkName=\"%s\" Target=\"%s\" TargetObj=\"%s\" OBJ-XID=\"%s\" Source=\"%s\"/>\n",
- xml_escape_the_name(name), xml_escape_the_name(buf),
- xml_escape_the_name(buf), xml_escape_the_name(name),
+ xml_escape_the_name(name),
+ xml_escape_the_name(buf),
+ xml_escape_the_name(tmp2),
+ xml_escape_the_name(tmp),
(strcmp(prefix, "") ? xml_escape_the_name(prefix) : "root"));
+ free(tmp2);
}
} else {
fflush(stdout);
@@ -1323,6 +1334,7 @@ dump_all(hid_t group, const char *name, void * op_data)
dump_header_format->datasetblockend);
} else {
/* the XML version */
+ strcat(strcat(tmp, "/"), name);
printf
("<Dataset Name=\"%s\" OBJ-XID=\"%s\" Parents=\"%s\">\n",
xml_escape_the_name(name),
@@ -3835,12 +3847,14 @@ xml_dump_named_datatype(hid_t type, const char *name)
the future.
*/
printf("<NamedDataType Name=\"%s\" OBJ-XID=\"%s\" Parents=\"%s\">\n",
- name, tmp, name);
+ name,
+ xml_escape_the_name(tmp),
+ (strcmp(prefix, "") ? xml_escape_the_name(prefix) : "root"));
} else {
printf("<NamedDataType Name=\"%s\" OBJ-XID=\"%s\" Parents=\"%s\">\n",
xml_escape_the_name(name),
xml_escape_the_name(tmp),
- (strcmp(prefix, "") ? xml_escape_the_name(name) : "root"));
+ (strcmp(prefix, "") ? xml_escape_the_name(prefix) : "root"));
}
indent += COL;
@@ -3952,7 +3966,8 @@ xml_dump_group(hid_t gid, const char *name)
} else {
printf("<Group Name=\"%s\" OBJ-XID=\"%s\" Parents=\"%s\" >\n",
xml_escape_the_name(name),
- xml_escape_the_name(tmp), xml_escape_the_name(par));
+ xml_escape_the_name(tmp),
+ (strcmp(prefix, "") ? xml_escape_the_name(par) : "root"));
}
indent += COL;
H5Gget_objinfo(gid, ".", TRUE, &statbuf);