summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-07-17 19:03:43 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-07-17 19:03:43 (GMT)
commit79d65106abab53203ad5c6ceda033f65eb2d3099 (patch)
treeccae5dbbda58bd5d9f48c3fd8a77dd3ad4a4e9dc /tools
parent6bea093682dff9ceba41f501010c513803da751a (diff)
downloadhdf5-79d65106abab53203ad5c6ceda033f65eb2d3099.zip
hdf5-79d65106abab53203ad5c6ceda033f65eb2d3099.tar.gz
hdf5-79d65106abab53203ad5c6ceda033f65eb2d3099.tar.bz2
[svn-r514] Changes since 19980715
---------------------- ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fsplit.c Changed the allocation size request from `size_t' to `hsize_t' because it was overflowing for the `big' test. ./src/H5detect.c If `long double' and `double' are the same size then we define H5T_NATIVE_LDOUBLE to be the same as H5T_NATIVE_DOUBLE. Similarly for `long' vs. `long long' and `unsigned long' vs. `unsigned long long'. ./test/Makefile.in Added `big' to the list of tests to normally run. ./test/big.c Added a check to see if the file system supports holes and if it doesn't then the test is skipped. ./RELEASE Added a couple minor details details about API tracing and symbolic links. ./src/H5public.h Added comments about the use of hbool_t. Fixed a comment spelling error. ./test/testhdf5.h Changed the way the version number is printed. The old method was `hdf5-1.2.3d' and the new method is `hdf5 version 1.2 release 3' ./tools/h5ls.c Only prints the max dimension if it differs from the current dimension or if verbose mode is enabled. Added switches `-?', `-h', and `--help' to print a usage message. Added switches `-v' and `--verbose' to generate more verbose output. Added switches `-V' and `--version' to print the version number and exit. The version number is printed like: This is h5ls version 1.0 release 24' ./bin/h5vers [NEW] This script prints, sets, and/or increments the hdf5 version number. It can be run from the top directory or any of the child directories like src, tools, test, etc. Some examples: $ h5vers # Display current version 1.0.24 $ h5vers -v version 1.0 release 24 # Display current version. $ h5vers -s 5.2.8 # Set version and display 5.2.8 $ h5vers -s 2.1 2.1.0 $ h5vers -s hdf5-1.0.24a.tar.bz2 1.0.24 $ h5vers -s 'version 2.0 release 8' 2.0.8 $ h5vers -s 'junk 22 junk 33 more junk 66 and 99 junk' 33.66.99 $ h5vers -i major # Increment from 1.0.24 2.0.0 $ h5vers -i minor # Increment from 1.0.24 1.1.0 $ h5vers -i release # Increment from 1.0.24 1.0.25 $ h5vers ~/hdf5/src/H5public.h # Use an alternate file 1.0.24 ./bin/checkapi [NEW] Run from the src directory with arguments H5[A-Z]*.c and it will print the locations of each place where an API function was called from within the library. Use it as the compile or grep command under Emacs and you can C-x ` through the list. ./bin/debug-ohdr [NEW] Keeps track of H5O_open() and H5O_close() debugging messages and lists the file addresses of the object headers that are opened but never closed. You must enable the `o' debugging at configuration time and pipe stderr into this script. ./bin/errors Added a note to indicate that this script no longer works because of changes in the HRETURN_ERROR() and HGOTO_ERROR() macros. ./bin/iostats [NEW] Watches output from the Linux strace program and accumulates statistics about low-level access to an hdf5 file. The output is a list of 2d data points which can be plotted by gnuplot to show file seeking behavior. ./MANIFEST Added new files.
Diffstat (limited to 'tools')
-rw-r--r--tools/h5ls.c105
1 files changed, 93 insertions, 12 deletions
diff --git a/tools/h5ls.c b/tools/h5ls.c
index 3e8a378..f6e3de7 100644
--- a/tools/h5ls.c
+++ b/tools/h5ls.c
@@ -19,13 +19,39 @@
# define __unused__ __attribute__((unused))
#endif
+/* Verbosity level */
+static int verbose_g = 0;
+
+
+/*-------------------------------------------------------------------------
+ * Function: usage
+ *
+ * Purpose: Prints a usage message on stderr and then returns.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Thursday, July 16, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
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);
+ fprintf(stderr, "\
+usage: %s [OPTIONS] FILE [GROUP]\n\
+ OPTIONS\n\
+ -h, -?, --help Print a usage message and exit\n\
+ -v, --verbose Generate more verbose output\n\
+ --version Print version number and exit\n\
+ FILE\n\
+ The file name may include a printf(3C) integer format such as\n\
+ \"%%05d\" to open a file family.\n\
+ GROUP\n\
+ If a group name is not specified then the contents of the root group\n\
+ \"/\" are displayed.\n", progname);
}
@@ -117,11 +143,12 @@ list (hid_t group, const char *name, void __unused__ *op_data)
int ndims = H5Sextent_dims(space, size, maxsize);
printf ("Dataset {");
for (i=0; i<ndims; i++) {
- HDfprintf (stdout, "%s%Hu", i?", ":"", size[i]);
- if (maxsize[i]==H5S_UNLIMITED)
+ HDfprintf (stdout, "%s%Hu", i?", ":"", size[i]);
+ if (maxsize[i]==H5S_UNLIMITED) {
HDfprintf (stdout, "/%s", "Inf");
- else
- HDfprintf (stdout, "/%Hu", maxsize[i]);
+ } else if (maxsize[i]!=size[i] || verbose_g>0) {
+ HDfprintf(stdout, "/%Hu", maxsize[i]);
+ }
}
printf ("}\n");
H5Dclose (space);
@@ -174,14 +201,68 @@ main (int argc, char *argv[])
const char *fname = NULL;
const char *gname = "/";
const char *progname;
+ const char *s;
+ int argno;
- /* Arguments */
+ /* Name of this program without the path */
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];
+
+ /* Switches come before non-switch arguments */
+ for (argno=1; argno<argc && '-'==argv[argno][0]; argno++) {
+ if (!strcmp(argv[argno], "--")) {
+ /* Last switch */
+ argno++;
+ break;
+ } else if (!strcmp(argv[argno], "--help")) {
+ usage(progname);
+ exit(0);
+ } else if (!strcmp(argv[argno], "--verbose")) {
+ verbose_g++;
+ } else if (!strcmp(argv[argno], "--version")) {
+ printf("This is %s version %u.%u release %u\n",
+ progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
+ exit(0);
+ } else if ('-'!=argv[argno][1]) {
+ /* Single-letter switches */
+ for (s=argv[argno]+1; *s; s++) {
+ switch (*s) {
+ case '?':
+ case 'h': /* --help */
+ usage(progname);
+ exit(0);
+ case 'v': /* --verbose */
+ verbose_g++;
+ break;
+ case 'V': /* --version */
+ printf("This is %s version %u.%u release %u\n",
+ progname, H5_VERS_MAJOR, H5_VERS_MINOR,
+ H5_VERS_RELEASE);
+ exit(0);
+ default:
+ usage(progname);
+ exit(1);
+ }
+ }
+ } else {
+ usage(progname);
+ exit(1);
+ }
+ }
+ /* Non-switch arguments */
+ if (argno<argc) {
+ fname = argv[argno++];
+ } else {
+ usage(progname);
+ exit(1);
+ }
+ if (argno<argc) gname = argv[argno++];
+ if (argno<argc) {
+ usage(progname);
+ exit(1);
+ }
+
/*
* Open the file. If the file name contains a `%' then assume that a
* file family is being opened.