summaryrefslogtreecommitdiffstats
path: root/src/h5ls.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-05-13 17:58:24 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-05-13 17:58:24 (GMT)
commit34f5a59b9eb995997536575eeb796f745a2be784 (patch)
treec70515f61d6167c265f43c7d13c7c75d1e3608cb /src/h5ls.c
parentbb86785ce5b597cdc007f8494c6649b01e386455 (diff)
downloadhdf5-34f5a59b9eb995997536575eeb796f745a2be784.zip
hdf5-34f5a59b9eb995997536575eeb796f745a2be784.tar.gz
hdf5-34f5a59b9eb995997536575eeb796f745a2be784.tar.bz2
[svn-r398] Changes since 19980501
---------------------- ./src/H5Bprivate.h ./src/H5F.c ./src/H5Ffamily.c ./src/H5Fprivate.h ./src/H5Gpkg.h ./src/H5MF.c ./src/H5P.c ./src/H5Ppublic.h ./test/big.c ./html/Big.html ./html/Files.html Family members can now be any size >1kB. Got rid of some places where we were reading a property list after it was closed. ./MANIFEST ./src/Makefile.in ./src/h5repart.c A program to repartition file families. The source and/or destination may be files or file families. Examples: testhdf5 -c -o stab h5repart -m 1m tstab2.h5 x%05d.h5 h5repart -m 100k x%05d.h5 y%05d.h5 h5repart y%05d.h5 z.h5 diff tstab2.h5 z.h5 ./src/h5ls.c Added a usage message, replaced assertions with error messages. ./config/linux Made a warning message more obvious. Added better optimization flags for Pentium-Pro's.
Diffstat (limited to 'src/h5ls.c')
-rw-r--r--src/h5ls.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/h5ls.c b/src/h5ls.c
index ca2c139..f96448c 100644
--- a/src/h5ls.c
+++ b/src/h5ls.c
@@ -5,7 +5,6 @@
* Programmer: Robb Matzke <matzke@llnl.gov>
* Monday, March 23, 1998
*/
-#include <assert.h>
#include <hdf5.h>
#include <stdio.h>
#include <stdlib.h>
@@ -20,6 +19,16 @@
# define __unused__ __attribute__((unused))
#endif
+static void
+usage (const char *progname)
+{
+ fprintf (stderr, "usage: %s FILE [GROUP]\n", progname);
+ fprintf (stderr, " The file name may contain a printf integer format "
+ "to open a file family.\n");
+ exit (1);
+}
+
+
/*-------------------------------------------------------------------------
* Function: list
@@ -111,11 +120,14 @@ int
main (int argc, char *argv[])
{
hid_t file, plist=H5P_DEFAULT;
- herr_t status;
const char *fname = NULL;
const char *gname = "/";
-
- assert (argc>=2 && argc<=3);
+ const char *progname;
+
+ /* Arguments */
+ if ((progname=strrchr (argv[0], '/'))) progname++;
+ else progname = argv[0];
+ if (argc<2 || argc>3) usage (progname);
fname = argv[1];
if (argc>=3) gname = argv[2];
@@ -127,12 +139,8 @@ main (int argc, char *argv[])
plist = H5Pcreate (H5P_FILE_ACCESS);
H5Pset_family (plist, 0, H5P_DEFAULT);
}
- file = H5Fopen (fname, H5F_ACC_RDONLY, plist);
- assert (file>=0);
-
- status = H5Giterate (file, gname, NULL, list, NULL);
- assert (status>=0);
-
- H5Fclose (file);
+ if ((file = H5Fopen (fname, H5F_ACC_RDONLY, plist))<0) exit (1);
+ if (H5Giterate (file, gname, NULL, list, NULL)<0) exit (1);
+ if (H5Fclose (file)<0) exit (1);
return 0;
}