From 76f7bb10ac47d44e07fb31d72a689e51b5112ba8 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Wed, 4 Dec 2002 10:44:07 -0500 Subject: [svn-r6179] ./hdf5-devel/tools/h5ls/h5ls.c Purpose: New Feature; Optimization; Clean-up (Merged from 1.4 branch) Description: There is no symbolic constant to pass to functions that take an optional object ID for when the caller wants to indicate no object ID. In the past the caller always passed a negative integer. GPFS performs poorly. The h5ls tool decides whether to list the file name in the output based on a compile-time choice, which isn't always optimal at run time. Solution: Added a symbolic constant H5I_INVALID_HID. Added code to tell the mmfsd of GPFS to forego byte range token prefetching. h5ls decides whether to print the file name at runtime based on the number of objects being listed. Platforms tested: SuSE Linux (arborea), gcc and mpich-1.2.4 SunOS (baldric), gcc 2002-12-03 23:00:35 Robb Matzke * main: Replaced the H5LS_PREPEND_FILENAME compile-time symbol which was always defined, with a runtime decision. If h5ls is invoked with more than one argument then the file name is displayed as part of the object name, otherwise the file name is not displayed. --- tools/h5ls/h5ls.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index b414319..fd44113 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -17,12 +17,6 @@ #include "h5tools.h" #include "h5tools_utils.h" -/* - * If defined then include the file name as part of the object name when - * printing full object names. Otherwise leave the file name off. - */ -#define H5LS_PREPEND_FILENAME - /* Command-line switches */ static int verbose_g = 0; /*lots of extra output */ static int width_g = 80; /*output width in characters */ @@ -36,6 +30,7 @@ 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 */ static hbool_t simple_output_g = FALSE; /*make output more machine-readable */ +static hbool_t show_file_name_g = FALSE;/*show file name for full names */ /* Info to pass to the iteration functions */ typedef struct iter_t { @@ -1816,9 +1811,6 @@ fix_name(const char *path, const char *base) if (path) { /* Path, followed by slash */ -#ifdef H5LS_PREPEND_FILENAME - if ('/'!=*path) s[len++] = '/'; -#endif for (/*void*/; *path; path++) { if ('/'!=*path || '/'!=prev) prev = s[len++] = *path; } @@ -2129,6 +2121,7 @@ main (int argc, char *argv[]) * then there must have been something wrong with the file (perhaps it * doesn't exist). */ + show_file_name_g = (argc-argno > 1); /*show file names if more than one*/ while (argno