summaryrefslogtreecommitdiffstats
path: root/tools/h5ls/h5ls.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-06 17:05:16 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-06 17:05:16 (GMT)
commit5adf1ee1bab95cce501257e538b638a75c9e72fa (patch)
tree33102c066b0e6e0a5d9e09b373a604106e4806e2 /tools/h5ls/h5ls.c
parent30aad1fd3e4c12d97fdd90bbcae3db7f89eb6ec0 (diff)
downloadhdf5-5adf1ee1bab95cce501257e538b638a75c9e72fa.zip
hdf5-5adf1ee1bab95cce501257e538b638a75c9e72fa.tar.gz
hdf5-5adf1ee1bab95cce501257e538b638a75c9e72fa.tar.bz2
[svn-r12864] Description:
Changed H5Lget_linkval() to H5Lget_val(), per our design discussion last Friday afternoon. Tested on: Linux/32 2.6 (chicago)
Diffstat (limited to 'tools/h5ls/h5ls.c')
-rw-r--r--tools/h5ls/h5ls.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index effab89..e5117dc 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1720,11 +1720,11 @@ slink_open(hid_t location, const char *name)
{
char buf[64];
- if (H5Lget_linkval (location, name, sizeof(buf), buf, H5P_DEFAULT)<0) return -1;
- if (NULL==HDmemchr(buf, 0, sizeof(buf))) {
- strcpy(buf+sizeof(buf)-4, "...");
- }
- fputs(buf, stdout);
+ if(H5Lget_val(location, name, sizeof(buf), buf, H5P_DEFAULT) < 0)
+ return -1;
+ if(NULL == HDmemchr(buf, 0, sizeof(buf)))
+ HDstrcpy(buf + sizeof(buf) - 4, "...");
+ HDfputs(buf, stdout);
return 0;
}
@@ -1755,30 +1755,33 @@ udlink_open(hid_t location, const char *name)
char * filename = NULL;
char * path = NULL;
- if(H5Lget_info(location, name, &linfo, H5P_DEFAULT) < 0) return -1;
+ if(H5Lget_info(location, name, &linfo, H5P_DEFAULT) < 0)
+ return -1;
switch(linfo.type)
{
- /* For external links, try to display info for the object it points to */
- case H5L_TYPE_EXTERNAL:
- if ((buf = HDmalloc(linfo.u.link_size))==NULL) goto error;
- if (H5Lget_linkval (location, name, sizeof(buf), buf, H5P_DEFAULT)<0) goto error;
-
- if(H5Lunpack_elink_val(buf, linfo.u.link_size, &filename, &path) < 0) goto error;
- fputs("file: ", stdout);
- fputs(filename, stdout);
- fputs(" path: ", stdout);
- fputs(path, stdout);
- break;
-
- default:
- fputs("cannot follow UD links", stdout);
+ /* For external links, try to display info for the object it points to */
+ case H5L_TYPE_EXTERNAL:
+ if((buf = HDmalloc(linfo.u.link_size)) == NULL)
+ goto error;
+ if(H5Lget_val(location, name, sizeof(buf), buf, H5P_DEFAULT) < 0)
+ goto error;
+
+ if(H5Lunpack_elink_val(buf, linfo.u.link_size, &filename, &path) < 0) goto error;
+ HDfputs("file: ", stdout);
+ HDfputs(filename, stdout);
+ HDfputs(" path: ", stdout);
+ HDfputs(path, stdout);
+ break;
+
+ default:
+ HDfputs("cannot follow UD links", stdout);
}
return 0;
error:
if(buf)
- HDfree(buf);
+ HDfree(buf);
return -1;
}