diff options
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | acconfig.h | 12 | ||||
-rw-r--r-- | config/linux | 7 | ||||
-rwxr-xr-x | configure | 447 | ||||
-rw-r--r-- | configure.in | 35 | ||||
-rw-r--r-- | src/H5RA.c | 4 | ||||
-rw-r--r-- | src/H5config.h.in | 33 | ||||
-rw-r--r-- | src/H5private.h | 18 | ||||
-rw-r--r-- | tools/h5ls.c | 871 |
9 files changed, 1298 insertions, 131 deletions
@@ -1,4 +1,4 @@ -This is hdf5-1.1.22 released on Thu Nov 5 04:19:57 CST 1998 +This is hdf5-1.1.23 released on Fri Nov 6 10:29:37 CST 1998 Please refer to the INSTALL file for installation instructions. ------------------------------------------------------------------------------ @@ -24,3 +24,15 @@ /* Define if `struct stat' has the `st_blocks' field */ #undef HAVE_STAT_ST_BLOCKS + +/* Define if `struct text_info' is defined */ +#undef HAVE_STRUCT_TEXT_INFO + +/* Define if `struct videoconfig' is defined */ +#undef HAVE_STRUCT_VIDEOCONFIG + +/* Define if the ioctl TIOCGETD is defined */ +#undef HAVE_TIOCGETD + +/* Define if the ioctl TIOCGWINSZ is defined */ +#undef HAVE_TIOCGWINSZ diff --git a/config/linux b/config/linux index 3766079..9e3bc5c 100644 --- a/config/linux +++ b/config/linux @@ -62,13 +62,6 @@ PROFILE_CFLAGS=-pg PROFILE_CPPFLAGS= #---------------------------------------------------------------------------- -# Enable parallel support by default for Robb's development system. -# -if [ 'robb@arborea' = `whoami`@`hostname` ]; then - enable_parallel=${enable_parallel:-yes} -fi - -#---------------------------------------------------------------------------- # Values for overriding configuration tests when cross compiling. # This includes compiling on some machines where the serial front end # compiles for a parallel back end. @@ -1373,15 +1373,54 @@ else fi done +for ac_hdr in sys/ioctl.h sys/stat.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1381: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1386 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1391: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1380: checking for off_t" >&5 +echo "configure:1419: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1385 "configure" +#line 1424 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1409,12 +1448,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1413: checking for size_t" >&5 +echo "configure:1452: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1418 "configure" +#line 1457 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1442,14 +1481,14 @@ EOF fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:1446: checking whether byte ordering is bigendian" >&5 +echo "configure:1485: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext <<EOF -#line 1453 "configure" +#line 1492 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -1460,11 +1499,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext <<EOF -#line 1468 "configure" +#line 1507 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -1475,7 +1514,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1479: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1495,7 +1534,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 1499 "configure" +#line 1538 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -1508,7 +1547,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:1512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -1532,7 +1571,7 @@ EOF fi echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:1536: checking size of short" >&5 +echo "configure:1575: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1540,7 +1579,7 @@ else ac_cv_sizeof_short=2 else cat > conftest.$ac_ext <<EOF -#line 1544 "configure" +#line 1583 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1551,7 +1590,7 @@ main() exit(0); } EOF -if { (eval echo configure:1555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -1571,7 +1610,7 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1575: checking size of int" >&5 +echo "configure:1614: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1579,7 +1618,7 @@ else ac_cv_sizeof_int=4 else cat > conftest.$ac_ext <<EOF -#line 1583 "configure" +#line 1622 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1590,7 +1629,7 @@ main() exit(0); } EOF -if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -1610,7 +1649,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1614: checking size of long" >&5 +echo "configure:1653: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1618,7 +1657,7 @@ else ac_cv_sizeof_long=4 else cat > conftest.$ac_ext <<EOF -#line 1622 "configure" +#line 1661 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1629,7 +1668,7 @@ main() exit(0); } EOF -if { (eval echo configure:1633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -1649,7 +1688,7 @@ EOF echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:1653: checking size of long long" >&5 +echo "configure:1692: checking size of long long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1657,7 +1696,7 @@ else ac_cv_sizeof_long_long=8 else cat > conftest.$ac_ext <<EOF -#line 1661 "configure" +#line 1700 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1668,7 +1707,7 @@ main() exit(0); } EOF -if { (eval echo configure:1672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long=`cat conftestval` else @@ -1688,7 +1727,7 @@ EOF echo $ac_n "checking size of __int64""... $ac_c" 1>&6 -echo "configure:1692: checking size of __int64" >&5 +echo "configure:1731: checking size of __int64" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof___int64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1696,7 +1735,7 @@ else ac_cv_sizeof___int64=8 else cat > conftest.$ac_ext <<EOF -#line 1700 "configure" +#line 1739 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1707,7 +1746,7 @@ main() exit(0); } EOF -if { (eval echo configure:1711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof___int64=`cat conftestval` else @@ -1727,7 +1766,7 @@ EOF echo $ac_n "checking size of float""... $ac_c" 1>&6 -echo "configure:1731: checking size of float" >&5 +echo "configure:1770: checking size of float" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1735,7 +1774,7 @@ else ac_cv_sizeof_float=4 else cat > conftest.$ac_ext <<EOF -#line 1739 "configure" +#line 1778 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1746,7 +1785,7 @@ main() exit(0); } EOF -if { (eval echo configure:1750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_float=`cat conftestval` else @@ -1766,7 +1805,7 @@ EOF echo $ac_n "checking size of double""... $ac_c" 1>&6 -echo "configure:1770: checking size of double" >&5 +echo "configure:1809: checking size of double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1774,7 +1813,7 @@ else ac_cv_sizeof_double=8 else cat > conftest.$ac_ext <<EOF -#line 1778 "configure" +#line 1817 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1785,7 +1824,7 @@ main() exit(0); } EOF -if { (eval echo configure:1789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_double=`cat conftestval` else @@ -1805,7 +1844,7 @@ EOF echo $ac_n "checking size of long double""... $ac_c" 1>&6 -echo "configure:1809: checking size of long double" >&5 +echo "configure:1848: checking size of long double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1813,7 +1852,7 @@ else ac_cv_sizeof_long_double=8 else cat > conftest.$ac_ext <<EOF -#line 1817 "configure" +#line 1856 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1824,7 +1863,7 @@ main() exit(0); } EOF -if { (eval echo configure:1828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_double=`cat conftestval` else @@ -1844,7 +1883,7 @@ EOF echo $ac_n "checking size of size_t""... $ac_c" 1>&6 -echo "configure:1848: checking size of size_t" >&5 +echo "configure:1887: checking size of size_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1852,7 +1891,7 @@ else ac_cv_sizeof_size_t=4 else cat > conftest.$ac_ext <<EOF -#line 1856 "configure" +#line 1895 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1863,7 +1902,7 @@ main() exit(0); } EOF -if { (eval echo configure:1867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_size_t=`cat conftestval` else @@ -1886,7 +1925,7 @@ cat >>confdefs.h <<\EOF #include <sys/types.h> /*for off_t definition*/ EOF echo $ac_n "checking size of off_t""... $ac_c" 1>&6 -echo "configure:1890: checking size of off_t" >&5 +echo "configure:1929: checking size of off_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1894,7 +1933,7 @@ else ac_cv_sizeof_off_t=4 else cat > conftest.$ac_ext <<EOF -#line 1898 "configure" +#line 1937 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1905,7 +1944,7 @@ main() exit(0); } EOF -if { (eval echo configure:1909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_off_t=`cat conftestval` else @@ -1932,7 +1971,7 @@ if test "${enable_hsizet+set}" = set; then fi echo $ac_n "checking for sizeof hsize_t and hssize_t""... $ac_c" 1>&6 -echo "configure:1936: checking for sizeof hsize_t and hssize_t" >&5 +echo "configure:1975: checking for sizeof hsize_t and hssize_t" >&5 case $HSIZET in no|small) echo "$ac_t""small" 1>&6 @@ -1948,9 +1987,9 @@ esac echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:1952: checking for tm_gmtoff in struct tm" >&5 +echo "configure:1991: checking for tm_gmtoff in struct tm" >&5 cat > conftest.$ac_ext <<EOF -#line 1954 "configure" +#line 1993 "configure" #include "confdefs.h" #include <sys/time.h> @@ -1959,7 +1998,7 @@ int main() { struct tm tm; tm.tm_gmtoff=0; ; return 0; } EOF -if { (eval echo configure:1963: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TM_GMTOFF 1 @@ -1975,9 +2014,9 @@ fi rm -f conftest* echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6 -echo "configure:1979: checking for global timezone variable" >&5 +echo "configure:2018: checking for global timezone variable" >&5 cat > conftest.$ac_ext <<EOF -#line 1981 "configure" +#line 2020 "configure" #include "confdefs.h" #include <sys/time.h> @@ -1986,7 +2025,7 @@ int main() { timezone=0; ; return 0; } EOF -if { (eval echo configure:1990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TIMEZONE 1 @@ -2002,12 +2041,12 @@ fi rm -f conftest* echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:2006: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:2045: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2011 "configure" +#line 2050 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -2015,7 +2054,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:2019: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -2036,12 +2075,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:2040: checking for tm_zone in struct tm" >&5 +echo "configure:2079: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2045 "configure" +#line 2084 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_cv_struct_tm> @@ -2049,7 +2088,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:2053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2092: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -2069,12 +2108,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:2073: checking for tzname" >&5 +echo "configure:2112: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2078 "configure" +#line 2117 "configure" #include "confdefs.h" #include <time.h> #ifndef tzname /* For SGI. */ @@ -2084,7 +2123,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:2088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -2106,9 +2145,9 @@ EOF fi echo $ac_n "checking for struct timezone""... $ac_c" 1>&6 -echo "configure:2110: checking for struct timezone" >&5 +echo "configure:2149: checking for struct timezone" >&5 cat > conftest.$ac_ext <<EOF -#line 2112 "configure" +#line 2151 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2118,7 +2157,7 @@ int main() { struct timezone tz; tz.tz_minuteswest=0; ; return 0; } EOF -if { (eval echo configure:2122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2161: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_STRUCT_TIMEZONE 1 @@ -2134,9 +2173,9 @@ fi rm -f conftest* echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:2138: checking for st_blocks in struct stat" >&5 +echo "configure:2177: checking for st_blocks in struct stat" >&5 cat > conftest.$ac_ext <<EOF -#line 2140 "configure" +#line 2179 "configure" #include "confdefs.h" #include <sys/stat.h> @@ -2144,7 +2183,7 @@ int main() { struct stat sb; sb.st_blocks=0; ; return 0; } EOF -if { (eval echo configure:2148: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_STAT_ST_BLOCKS 1 @@ -2159,15 +2198,227 @@ else fi rm -f conftest* +for ac_func in _getvideoconfig gettextinfo GetConsoleScreenBufferInfo +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2205: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2210 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in _scrsize ioctl +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2260: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2265 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +echo $ac_n "checking for struct videoconfig""... $ac_c" 1>&6 +echo "configure:2314: checking for struct videoconfig" >&5 +cat > conftest.$ac_ext <<EOF +#line 2316 "configure" +#include "confdefs.h" + +int main() { +struct videoconfig w; w.numtextcols=0; +; return 0; } +EOF +if { (eval echo configure:2323: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_VIDEOCONFIG 1 +EOF + +echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +echo $ac_n "checking for struct text_info""... $ac_c" 1>&6 +echo "configure:2339: checking for struct text_info" >&5 +cat > conftest.$ac_ext <<EOF +#line 2341 "configure" +#include "confdefs.h" + +int main() { +struct text_info w; w.screenwidth=0; +; return 0; } +EOF +if { (eval echo configure:2348: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_TEXT_INFO 1 +EOF + +echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +echo $ac_n "checking for TIOCGWINSZ""... $ac_c" 1>&6 +echo "configure:2364: checking for TIOCGWINSZ" >&5 +cat > conftest.$ac_ext <<EOF +#line 2366 "configure" +#include "confdefs.h" +#include <sys/ioctl.h> +int main() { +int w=TIOCGWINSZ; +; return 0; } +EOF +if { (eval echo configure:2373: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_TIOCGWINSZ 1 +EOF + +echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + +echo $ac_n "checking for TIOCGGETD""... $ac_c" 1>&6 +echo "configure:2389: checking for TIOCGGETD" >&5 +cat > conftest.$ac_ext <<EOF +#line 2391 "configure" +#include "confdefs.h" +#include <sys/ioctl.h> +int main() { +int w=TIOCGETD; +; return 0; } +EOF +if { (eval echo configure:2398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF +#define HAVE_TIOCGETD 1 +EOF + +echo "$ac_t""yes" 1>&6 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "$ac_t""no" 1>&6 +fi +rm -f conftest* + + for ac_func in getpwuid gethostname system getrusage fork waitpid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2166: checking for $ac_func" >&5 +echo "configure:2417: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2171 "configure" +#line 2422 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2190,7 +2441,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2217,12 +2468,12 @@ done for ac_func in gettimeofday BSDgettimeofday difftime sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2221: checking for $ac_func" >&5 +echo "configure:2472: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2226 "configure" +#line 2477 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2245,7 +2496,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2271,24 +2522,24 @@ done cat > conftest.$ac_ext <<EOF -#line 2275 "configure" +#line 2526 "configure" #include "confdefs.h" #include<sys/types.h> int main() { off64_t n = 0; ; return 0; } EOF -if { (eval echo configure:2282: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* for ac_func in lseek64 fseek64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2287: checking for $ac_func" >&5 +echo "configure:2538: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2292 "configure" +#line 2543 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2311,7 +2562,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2346,12 +2597,12 @@ rm -f conftest* echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2350: checking for working const" >&5 +echo "configure:2601: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2355 "configure" +#line 2606 "configure" #include "confdefs.h" int main() { @@ -2400,7 +2651,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:2404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2421,21 +2672,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2425: checking for inline" >&5 +echo "configure:2676: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 2432 "configure" +#line 2683 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:2439: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2690: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2462,16 +2713,16 @@ esac echo $ac_n "checking for __attribute__ extension""... $ac_c" 1>&6 -echo "configure:2466: checking for __attribute__ extension" >&5 +echo "configure:2717: checking for __attribute__ extension" >&5 cat > conftest.$ac_ext <<EOF -#line 2468 "configure" +#line 2719 "configure" #include "confdefs.h" int main() { int __attribute__((unused)) f(void){return 1;} ; return 0; } EOF -if { (eval echo configure:2475: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_ATTRIBUTE 1 @@ -2487,16 +2738,16 @@ fi rm -f conftest* echo $ac_n "checking for __FUNCTION__ extension""... $ac_c" 1>&6 -echo "configure:2491: checking for __FUNCTION__ extension" >&5 +echo "configure:2742: checking for __FUNCTION__ extension" >&5 cat > conftest.$ac_ext <<EOF -#line 2493 "configure" +#line 2744 "configure" #include "confdefs.h" int main() { int f(void){return __FUNCTION__;} ; return 0; } EOF -if { (eval echo configure:2500: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_FUNCTION 1 @@ -2512,7 +2763,7 @@ fi rm -f conftest* echo $ac_n "checking how to print long long""... $ac_c" 1>&6 -echo "configure:2516: checking how to print long long" >&5 +echo "configure:2767: checking how to print long long" >&5 if eval "test \"`echo '$''{'hdf5_cv_printf_ll'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2521,7 +2772,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2525 "configure" +#line 2776 "configure" #include "confdefs.h" #include <stdio.h> @@ -2532,7 +2783,7 @@ else sprintf(s,"%${hdf5_cv_printf_ll}d",x); exit (strcmp(s,"1099511627776"));} EOF -if { (eval echo configure:2536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then break else @@ -2553,7 +2804,7 @@ EOF echo $ac_n "checking for debug flags""... $ac_c" 1>&6 -echo "configure:2557: checking for debug flags" >&5 +echo "configure:2808: checking for debug flags" >&5 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" @@ -2585,7 +2836,7 @@ if test "X" != "X$DEBUG_PKG"; then fi echo $ac_n "checking for API tracing""... $ac_c" 1>&6 -echo "configure:2589: checking for API tracing" >&5; +echo "configure:2840: checking for API tracing" >&5; # Check whether --enable-trace or --disable-trace was given. if test "${enable_trace+set}" = set; then enableval="$enable_trace" @@ -2608,7 +2859,7 @@ if test "${enable_parallel+set}" = set; then fi echo $ac_n "checking for parallel support""... $ac_c" 1>&6 -echo "configure:2612: checking for parallel support" >&5; +echo "configure:2863: checking for parallel support" >&5; case "X-$PARALLEL" in @@ -2633,7 +2884,7 @@ EOF CFLAGS="$CFLAGS $MPI_LIB" RUNTEST="$RUNTEST" echo $ac_n "checking for main in -lmpi""... $ac_c" 1>&6 -echo "configure:2637: checking for main in -lmpi" >&5 +echo "configure:2888: checking for main in -lmpi" >&5 ac_lib_var=`echo mpi'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2641,14 +2892,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lmpi $LIBS" cat > conftest.$ac_ext <<EOF -#line 2645 "configure" +#line 2896 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2675,7 +2926,7 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for main in -lmpio""... $ac_c" 1>&6 -echo "configure:2679: checking for main in -lmpio" >&5 +echo "configure:2930: checking for main in -lmpio" >&5 ac_lib_var=`echo mpio'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2683,14 +2934,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lmpio $LIBS" cat > conftest.$ac_ext <<EOF -#line 2687 "configure" +#line 2938 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index 0999e01..e92677c 100644 --- a/configure.in +++ b/configure.in @@ -123,7 +123,7 @@ esac dnl ---------------------------------------------------------------------- -dnl Check for libraries. (none required yet) +dnl Check for libraries. dnl AC_CHECK_LIB(m, ceil) AC_CHECK_LIB(coug, main) dnl ...for ASCI/Red @@ -135,7 +135,7 @@ dnl AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS(io.h sys/resource.h sys/time.h unistd.h winsock.h zlib.h) - +AC_CHECK_HEADERS(sys/ioctl.h sys/stat.h) dnl ---------------------------------------------------------------------- dnl Data types and their sizes. @@ -221,6 +221,37 @@ AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl ---------------------------------------------------------------------- +dnl How do we figure out the width of a tty in characters? +dnl +AC_CHECK_FUNCS(_getvideoconfig gettextinfo GetConsoleScreenBufferInfo) +AC_CHECK_FUNCS(_scrsize ioctl) + +AC_MSG_CHECKING(for struct videoconfig) +AC_TRY_COMPILE(,[struct videoconfig w; w.numtextcols=0;], +AC_DEFINE(HAVE_STRUCT_VIDEOCONFIG) +AC_MSG_RESULT(yes), +AC_MSG_RESULT(no)) + +AC_MSG_CHECKING(for struct text_info) +AC_TRY_COMPILE(,[struct text_info w; w.screenwidth=0;], +AC_DEFINE(HAVE_STRUCT_TEXT_INFO) +AC_MSG_RESULT(yes), +AC_MSG_RESULT(no)) + +AC_MSG_CHECKING(for TIOCGWINSZ) +AC_TRY_COMPILE([#include <sys/ioctl.h>],[int w=TIOCGWINSZ;], +AC_DEFINE(HAVE_TIOCGWINSZ) +AC_MSG_RESULT(yes), +AC_MSG_RESULT(no)) + +AC_MSG_CHECKING(for TIOCGGETD) +AC_TRY_COMPILE([#include <sys/ioctl.h>],[int w=TIOCGETD;], +AC_DEFINE(HAVE_TIOCGETD) +AC_MSG_RESULT(yes), +AC_MSG_RESULT(no)) + + +dnl ---------------------------------------------------------------------- dnl Check for functions. dnl AC_CHECK_FUNCS(getpwuid gethostname system getrusage fork waitpid) @@ -431,8 +431,8 @@ H5RA_isa(H5G_entry_t *ent) } /* Is `raw' a dataset? */ - if (H5G_find(ent, "raw", NULL, &d_ent)<0 || - (exists=H5D_isa(&d_ent))<0) { + if (H5G_find(ent, "raw", NULL, &d_ent)<0) HRETURN(FALSE); + if ((exists=H5D_isa(&d_ent))<0) { HRETURN_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found"); } else if (!exists) { HRETURN(FALSE); diff --git a/src/H5config.h.in b/src/H5config.h.in index a08c7e2..88b268d 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -59,6 +59,18 @@ /* Define if `struct stat' has the `st_blocks' field */ #undef HAVE_STAT_ST_BLOCKS +/* Define if `struct text_info' is defined */ +#undef HAVE_STRUCT_TEXT_INFO + +/* Define if `struct videoconfig' is defined */ +#undef HAVE_STRUCT_VIDEOCONFIG + +/* Define if the ioctl TIOCGETD is defined */ +#undef HAVE_TIOCGETD + +/* Define if the ioctl TIOCGWINSZ is defined */ +#undef HAVE_TIOCGWINSZ + /* The number of bytes in a __int64. */ #undef SIZEOF___INT64 @@ -92,6 +104,15 @@ /* Define if you have the BSDgettimeofday function. */ #undef HAVE_BSDGETTIMEOFDAY +/* Define if you have the GetConsoleScreenBufferInfo function. */ +#undef HAVE_GETCONSOLESCREENBUFFERINFO + +/* Define if you have the _getvideoconfig function. */ +#undef HAVE__GETVIDEOCONFIG + +/* Define if you have the _scrsize function. */ +#undef HAVE__SCRSIZE + /* Define if you have the difftime function. */ #undef HAVE_DIFFTIME @@ -110,9 +131,15 @@ /* Define if you have the getrusage function. */ #undef HAVE_GETRUSAGE +/* Define if you have the gettextinfo function. */ +#undef HAVE_GETTEXTINFO + /* Define if you have the gettimeofday function. */ #undef HAVE_GETTIMEOFDAY +/* Define if you have the ioctl function. */ +#undef HAVE_IOCTL + /* Define if you have the lseek64 function. */ #undef HAVE_LSEEK64 @@ -128,9 +155,15 @@ /* Define if you have the <io.h> header file. */ #undef HAVE_IO_H +/* Define if you have the <sys/ioctl.h> header file. */ +#undef HAVE_SYS_IOCTL_H + /* Define if you have the <sys/resource.h> header file. */ #undef HAVE_SYS_RESOURCE_H +/* Define if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + /* Define if you have the <sys/time.h> header file. */ #undef HAVE_SYS_TIME_H diff --git a/src/H5private.h b/src/H5private.h index 2769269..3ef8c1d 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -39,12 +39,20 @@ # include <unistd.h> #endif #ifdef _POSIX_VERSION -# include <sys/stat.h> # include <sys/wait.h> # include <pwd.h> #endif /* + * The `struct stat' data type for stat() and fstat(). This is a Posix file + * but often apears on non-Posix systems also. The `struct stat' is required + * for hdf5 to compile, although only a few fields are actually used. + */ +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif + +/* * If a program may include both `time.h' and `sys/time.h' then * TIME_WITH_SYS_TIME is defined (see AC_HEADER_TIME in configure.in). * On some older systems, `sys/time.h' includes `time.h' but `time.h' is not @@ -72,6 +80,14 @@ #endif /* + * Unix ioctls. These are used by h5ls (and perhaps others) to determine a + * resonable output width. + */ +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif + +/* * Win32 is severely broken when it comes to ANSI-C and Posix.1 compliance. */ #ifdef HAVE_IO_H diff --git a/tools/h5ls.c b/tools/h5ls.c index 3d7b845..383c590 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -23,10 +23,11 @@ #endif /* Command-line switches */ -static int verbose_g = 0; -static int dump_g = 0; -static int width_g = 80; -static int string_g = FALSE; +static int verbose_g = 0; /*lots of extra output */ +static int width_g = 80; /*output width in characters */ +static hbool_t dump_g = FALSE; /*display dataset values? */ +static hbool_t label_g = FALSE; /*label compound values? */ +static hbool_t string_g = FALSE; /*print 1-byte numbers as ASCII? */ /* Information about how to display each type of object */ static struct dispatch_t { @@ -46,6 +47,7 @@ static struct dispatch_t { } static herr_t list (hid_t group, const char *name, void *cd); +static void display_type(hid_t type, int indent); /*------------------------------------------------------------------------- @@ -70,6 +72,7 @@ usage: %s [OPTIONS] FILE [OBJECTS...]\n\ OPTIONS\n\ -h, -?, --help Print a usage message and exit\n\ -d, --dump Print the values of datasets\n\ + -l, --label Label members of compound datasets\n\ -s, --string Print 1-byte integer datasets as ASCII\n\ -wN, --width=N Set the number of columns of output\n\ -v, --verbose Generate more verbose output\n\ @@ -87,6 +90,669 @@ usage: %s [OPTIONS] FILE [OBJECTS...]\n\ /*------------------------------------------------------------------------- + * Function: display_string + * + * Purpose: Print a string value by escaping unusual characters. + * + * Return: Number of characters printed. + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +display_string(const char *s) +{ + int nprint=0; + + for (/*void*/; s && *s; s++) { + switch (*s) { + case '"': + printf("\\\""); + nprint += 2; + break; + case '\\': + printf("\\\\"); + nprint += 2; + break; + case '\b': + printf("\\b"); + nprint += 2; + break; + case '\f': + printf("\\f"); + nprint += 2; + break; + case '\n': + printf("\\n"); + nprint += 2; + break; + case '\r': + printf("\\r"); + nprint += 2; + break; + case '\t': + printf("\\t"); + nprint += 2; + break; + default: + if (isprint(*s)) { + putchar(*s); + nprint++; + } else { + printf("\\%03o", *((const unsigned char*)s)); + nprint += 4; + } + break; + } + } + return nprint; +} + + +/*------------------------------------------------------------------------- + * Function: display_native_type + * + * Purpose: Prints the name of a native C data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed. + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_native_type(hid_t type, int __unused__ indent) +{ + if (H5Tequal(type, H5T_NATIVE_CHAR)) { + printf("native char"); + } else if (H5Tequal(type, H5T_NATIVE_UCHAR)) { + printf("native unsigned char"); + } else if (H5Tequal(type, H5T_NATIVE_SHORT)) { + printf("native short"); + } else if (H5Tequal(type, H5T_NATIVE_USHORT)) { + printf("native unsigned short"); + } else if (H5Tequal(type, H5T_NATIVE_INT)) { + printf("native int"); + } else if (H5Tequal(type, H5T_NATIVE_UINT)) { + printf("native unsigned int"); + } else if (H5Tequal(type, H5T_NATIVE_LONG)) { + printf("native long"); + } else if (H5Tequal(type, H5T_NATIVE_ULONG)) { + printf("native unsigned long"); + } else if (H5Tequal(type, H5T_NATIVE_LLONG)) { + printf("native long long"); + } else if (H5Tequal(type, H5T_NATIVE_ULLONG)) { + printf("native unsigned long long"); + } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { + printf("native float"); + } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { + printf("native double"); + } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) { + printf("native long double"); + } else if (H5Tequal(type, H5T_NATIVE_B8)) { + printf("native 8-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B16)) { + printf("native 16-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B32)) { + printf("native 32-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_B64)) { + printf("native 64-bit field"); + } else if (H5Tequal(type, H5T_NATIVE_HSIZE)) { + printf("native hsize_t"); + } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) { + printf("native hssize_t"); + } else if (H5Tequal(type, H5T_NATIVE_HERR)) { + printf("native herr_t"); + } else if (H5Tequal(type, H5T_NATIVE_HBOOL)) { + printf("native hbool_t"); + } else { + return FALSE; + } + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_ieee_type + * + * Purpose: Print the name of an IEEE floating-point data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_ieee_type(hid_t type, int __unused__ indent) +{ + if (H5Tequal(type, H5T_IEEE_F32BE)) { + printf("IEEE 32-bit big-endian float"); + } else if (H5Tequal(type, H5T_IEEE_F32LE)) { + printf("IEEE 32-bit little-endian float"); + } else if (H5Tequal(type, H5T_IEEE_F64BE)) { + printf("IEEE 64-bit big-endian float"); + } else if (H5Tequal(type, H5T_IEEE_F64LE)) { + printf("IEEE 64-bit little-endian float"); + } else { + return FALSE; + } + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_precision + * + * Purpose: Prints information on the next line about precision and + * padding if the precision is less than the total data type + * size. + * + * Return: void + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +display_precision(hid_t type, int indent) +{ + size_t prec; /*precision */ + H5T_pad_t plsb, pmsb; /*lsb and msb padding */ + const char *plsb_s=NULL; /*lsb padding string */ + const char *pmsb_s=NULL; /*msb padding string */ + size_t nbits; /*number of bits */ + + /* + * If the precision is less than the total size then show the precision + * and offset on the following line. Also display the padding + * information. + */ + if (8*H5Tget_size(type)!=(prec=H5Tget_precision(type))) { + printf("\n%*s(%lu bit%s of precision beginning at bit %lu)", + indent, "", (unsigned long)prec, 1==prec?"":"s", + (unsigned long)H5Tget_offset(type)); + + H5Tget_pad(type, &plsb, &pmsb); + if (H5Tget_offset(type)>0) { + switch (plsb) { + case H5T_PAD_ZERO: + plsb_s = "zero"; + break; + case H5T_PAD_ONE: + plsb_s = "one"; + break; + case H5T_PAD_BACKGROUND: + plsb_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + plsb_s = "unknown"; + break; + } + } + if (H5Tget_offset(type)+prec<8*H5Tget_size(type)) { + switch (pmsb) { + case H5T_PAD_ZERO: + pmsb_s = "zero"; + break; + case H5T_PAD_ONE: + pmsb_s = "one"; + break; + case H5T_PAD_BACKGROUND: + pmsb_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + pmsb_s = "unknown"; + break; + } + } + if (plsb_s || pmsb_s) { + printf("\n%*s(", indent, ""); + if (plsb_s) { + nbits = H5Tget_offset(type); + printf("%lu %s bit%s at bit 0", + (unsigned long)nbits, plsb_s, 1==nbits?"":"s"); + } + if (plsb_s && pmsb_s) printf(", "); + if (pmsb_s) { + nbits = 8*H5Tget_size(type)-(H5Tget_offset(type)+prec); + printf("%lu %s bit%s at bit %lu", + (unsigned long)nbits, pmsb_s, 1==nbits?"":"s", + (unsigned long)(8*H5Tget_size(type)-nbits)); + } + printf(")"); + } + } +} + + +/*------------------------------------------------------------------------- + * Function: display_int_type + * + * Purpose: Print the name of an integer data type. Common information + * like number of bits, byte order, and sign scheme appear on + * the first line. Additional information might appear in + * parentheses on the following lines. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_int_type(hid_t type, int indent) +{ + H5T_order_t order; /*byte order value */ + const char *order_s=NULL; /*byte order string */ + H5T_sign_t sign; /*sign scheme value */ + const char *sign_s=NULL; /*sign scheme string */ + + if (H5T_INTEGER!=H5Tget_class(type)) return FALSE; + + /* Byte order */ + if (H5Tget_size(type)>1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } else { + order_s = " unknown-byte-order"; + } + } else { + order_s = ""; + } + + /* Sign */ + if (H5T_SGN_NONE==sign) { + sign_s = " unsigned"; + } else if (H5T_SGN_2==sign) { + sign_s = ""; + } else { + sign_s = " unknown-sign"; + } + + /* + * Print size, order, and sign on first line, precision and padding + * information on the subsequent lines + */ + printf("%lu-bit%s%s integer", + (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); + display_precision(type, indent); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_float_type + * + * Purpose: Print info about a floating point data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_float_type(hid_t type, int indent) +{ + H5T_order_t order; /*byte order value */ + const char *order_s=NULL; /*byte order string */ + size_t spos; /*sign bit position */ + size_t esize, epos; /*exponent size and position */ + size_t msize, mpos; /*significand size and position */ + size_t ebias; /*exponent bias */ + H5T_norm_t norm; /*significand normalization */ + const char *norm_s=NULL; /*normalization string */ + H5T_pad_t pad; /*internal padding value */ + const char *pad_s=NULL; /*internal padding string */ + + if (H5T_FLOAT!=H5Tget_class(type)) return FALSE; + + /* Byte order */ + if (H5Tget_size(type)>1) { + order = H5Tget_order(type); + if (H5T_ORDER_LE==order) { + order_s = " little-endian"; + } else if (H5T_ORDER_BE==order) { + order_s = " big-endian"; + } else if (H5T_ORDER_VAX==order) { + order_s = " mixed-endian"; + } else { + order_s = " unknown-byte-order"; + } + } else { + order_s = ""; + } + + /* + * Print size and byte order on first line, precision and padding on + * subsequent lines. + */ + printf("%lu-bit%s floating-point", + (unsigned long)(8*H5Tget_size(type)), order_s); + display_precision(type, indent); + + /* Print sizes, locations, and other information about each field */ + H5Tget_fields (type, &spos, &epos, &esize, &mpos, &msize); + ebias = H5Tget_ebias(type); + norm = H5Tget_norm(type); + switch (norm) { + case H5T_NORM_IMPLIED: + norm_s = ", msb implied"; + break; + case H5T_NORM_MSBSET: + norm_s = ", msb always set"; + break; + case H5T_NORM_NONE: + norm_s = ", no normalization"; + break; + case H5T_NORM_ERROR: + norm_s = ", unknown normalization"; + break; + } + printf("\n%*s(significant for %lu bit%s at bit %lu%s)", indent, "", + (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, + norm_s); + printf("\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", + indent, "", (unsigned long)esize, 1==esize?"":"s", + (unsigned long)epos, (unsigned long)ebias); + printf("\n%*s(sign bit at %lu)", indent, "", (unsigned long)spos); + return TRUE; + + /* Display internal padding */ + if (1+esize+msize<H5Tget_precision(type)) { + pad = H5Tget_inpad(type); + switch (pad) { + case H5T_PAD_ZERO: + pad_s = "zero"; + break; + case H5T_PAD_ONE: + pad_s = "one"; + break; + case H5T_PAD_BACKGROUND: + pad_s = "bkg"; + break; + case H5T_PAD_ERROR: + case H5T_NPAD: + pad_s = "unknown"; + break; + } + printf("\n%*s(internal padding bits are %s)", indent, "", pad_s); + } + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_cmpd_type + * + * Purpose: Print info about a compound data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_cmpd_type(hid_t type, int indent) +{ + char *name=NULL; /*member name */ + int ndims; /*dimensionality */ + size_t dims[8]; /*dimensions */ + int perm[8]; /*index permutation */ + hid_t subtype; /*member data type */ + int i, j, n; /*miscellaneous counters */ + + + if (H5T_COMPOUND!=H5Tget_class(type)) return FALSE; + printf("struct {"); + for (i=0; i<H5Tget_nmembers(type); i++) { + + /* Name and offset */ + name = H5Tget_member_name(type, i); + printf("\n%*s\"", indent+4, ""); + n = display_string(name); + printf("\"%*s +%-4lu ", MAX(0, 16-n), "", + (unsigned long)H5Tget_member_offset(type, i)); + free(name); + + /* Dimensions and permutation */ + ndims = H5Tget_member_dims(type, i, dims, perm); + if (ndims>0) { + printf("["); + for (j=0; j<ndims; j++) { + printf("%s%lu", j?",":"", (unsigned long)(dims[j])); + } + printf("]"); + for (j=0; j<ndims; j++) { + if (perm[j]!=j) break; + } + if (j<ndims) { + printf("x["); + for (j=0; j<ndims; j++) { + printf("%s%d", j?",":"", perm[j]); + } + printf("]"); + } + printf(" "); + } + + /* Data type */ + subtype = H5Tget_member_type(type, i); + display_type(subtype, indent+4); + H5Tclose(subtype); + } + printf("\n%*s}", indent, ""); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_string + * + * Purpose: Print information about a string data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_string_type(hid_t type, int __unused__ indent) +{ + H5T_str_t pad; + const char *pad_s=NULL; + H5T_cset_t cset; + const char *cset_s=NULL; + + if (H5T_STRING!=H5Tget_class(type)) return FALSE; + + /* Padding */ + pad = H5Tget_strpad(type); + switch (pad) { + case H5T_STR_NULLTERM: + pad_s = "null-terminated"; + break; + case H5T_STR_NULLPAD: + pad_s = "null-padded"; + break; + case H5T_STR_SPACEPAD: + pad_s = "space-padded"; + break; + case H5T_STR_RESERVED_3: + case H5T_STR_RESERVED_4: + case H5T_STR_RESERVED_5: + case H5T_STR_RESERVED_6: + case H5T_STR_RESERVED_7: + case H5T_STR_RESERVED_8: + case H5T_STR_RESERVED_9: + case H5T_STR_RESERVED_10: + case H5T_STR_RESERVED_11: + case H5T_STR_RESERVED_12: + case H5T_STR_RESERVED_13: + case H5T_STR_RESERVED_14: + case H5T_STR_RESERVED_15: + case H5T_STR_ERROR: + pad_s = "unknown-format"; + break; + } + + /* Character set */ + cset = H5Tget_cset(type); + switch (cset) { + case H5T_CSET_ASCII: + cset_s = "ASCII"; + break; + case H5T_CSET_RESERVED_1: + case H5T_CSET_RESERVED_2: + case H5T_CSET_RESERVED_3: + case H5T_CSET_RESERVED_4: + case H5T_CSET_RESERVED_5: + case H5T_CSET_RESERVED_6: + case H5T_CSET_RESERVED_7: + case H5T_CSET_RESERVED_8: + case H5T_CSET_RESERVED_9: + case H5T_CSET_RESERVED_10: + case H5T_CSET_RESERVED_11: + case H5T_CSET_RESERVED_12: + case H5T_CSET_RESERVED_13: + case H5T_CSET_RESERVED_14: + case H5T_CSET_RESERVED_15: + case H5T_CSET_ERROR: + cset_s = "unknown-character-set"; + break; + } + + printf("%lu-byte %s %s string", + (unsigned long)H5Tget_size(type), pad_s, cset_s); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_reference_type + * + * Purpose: Prints information about a reference data type. + * + * Return: Success: TRUE + * + * Failure: FALSE, nothing printed + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hbool_t +display_reference_type(hid_t type, int __unused__ indent) +{ + if (H5T_REFERENCE!=H5Tget_class(type)) return FALSE; + + printf("%lu-byte unknown reference", + (unsigned long)H5Tget_size(type)); + return TRUE; +} + + +/*------------------------------------------------------------------------- + * Function: display_type + * + * Purpose: Prints a data type definition. The definition is printed + * without any leading space or trailing line-feed (although + * there might be line-feeds inside the type definition). The + * first line is assumed to have INDENT characters before it on + * the same line (printed by the caller). + * + * Return: void + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +display_type(hid_t type, int indent) +{ + H5T_class_t data_class; + + /* Bad data type */ + if (type<0) { + printf("<ERROR>"); + return; + } + + /* Shared? */ + if (H5Tcommitted(type)) printf("shared "); + + /* Print the type */ + if (display_native_type(type, indent) || + display_ieee_type(type, indent) || + display_int_type(type, indent) || + display_float_type(type, indent) || + display_cmpd_type(type, indent) || + display_string_type(type, indent) || + display_reference_type(type, indent)) { + return; + } + + /* Unknown type */ + printf("%lu-byte class-%u unknown", + (unsigned long)H5Tget_size(type), + (unsigned)data_class); +} + + +/*------------------------------------------------------------------------- * Function: dump_dataset_values * * Purpose: Prints all values of a dataset. @@ -111,7 +777,7 @@ dump_dataset_values(hid_t dset) memset(&info, 0, sizeof info); info.idx_fmt = " (%s) "; info.line_ncols = width_g; - if (verbose_g) info.cmpd_name = "%s="; + if (label_g) info.cmpd_name = "%s="; /* * If the dataset is a 1-byte integer type then format it as an ASCI @@ -223,6 +889,7 @@ dataset_list1(hid_t dset) HDfprintf(stdout, "/%Hu", max_size[i]); } } + if (0==ndims) printf("SCALAR"); putchar('}'); H5Sclose (space); @@ -251,19 +918,56 @@ static herr_t dataset_list2(hid_t dset) { hid_t dcpl; /*dataset creation property list*/ + hid_t type; /*data type of dataset */ int nf; /*number of filters */ unsigned filt_flags; /*filter flags */ H5Z_filter_t filt_id; /*filter identification number */ unsigned cd_values[20]; /*filter client data values */ size_t cd_nelmts; /*filter client number of values*/ size_t cd_num; /*filter client data counter */ - char f_name[32]; /*filter name */ + char f_name[256]; /*filter/file name */ char s[64]; /*temporary string buffer */ + off_t f_offset; /*offset in external file */ + hsize_t f_size; /*bytes used in external file */ + hsize_t total_offset; /*total dataset offset */ int i; + if (verbose_g>0) { dcpl = H5Dget_create_plist(dset); + /* Print data type */ + printf(" %-10s ", "Type:"); + type = H5Dget_type(dset); + display_type(type, 15); + H5Tclose(type); + printf("\n"); + + /* Print information about external strorage */ + if ((nf = H5Pget_external_count(dcpl))>0) { + printf(" %-10s %d external file%s (num/addr/offset/length)\n", + "Extern:", nf, 1==nf?"":"s"); + for (i=0, total_offset=0; i<nf; i++) { + if (H5Pget_external(dcpl, i, sizeof(f_name), f_name, &f_offset, + &f_size)<0) { + HDfprintf(stdout, + " #%03d %10Hu %10s %10s ***ERROR*** %s\n", + i, total_offset, "", "", + i+1<nf?"Following addresses are incorrect":""); + } else if (H5S_UNLIMITED==f_size) { + HDfprintf(stdout, " #%03d %10Hu %10Hu %10s \"", + i, total_offset, (hsize_t)f_offset, "INF"); + display_string(f_name); + } else { + HDfprintf(stdout, " #%03d %10Hu %10Hu %10Hu \"", + i, total_offset, (hsize_t)f_offset, f_size); + display_string(f_name); + } + printf("\"\n"); + total_offset += f_size; + } + } + /* Print information about raw data filters */ if ((nf = H5Pget_nfilters(dcpl))>0) { for (i=0; i<nf; i++) { @@ -291,6 +995,33 @@ dataset_list2(hid_t dset) /*------------------------------------------------------------------------- + * Function: datatype_list2 + * + * Purpose: List information about a data type which should appear after + * information which is general to all objects. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Robb Matzke + * Thursday, November 5, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +datatype_list2(hid_t type) +{ + printf(" %-10s ", "Type:"); + display_type(type, 15); + printf("\n"); + return 0; +} + + +/*------------------------------------------------------------------------- * Function: ragged_list2 * * Purpose: List information about a ragged array which should appear @@ -387,22 +1118,27 @@ list (hid_t group, const char *name, void __unused__ *cd) puts("**NOT FOUND**"); return 0; } else if (sb.type<0 || sb.type>=H5G_NTYPES) { - printf("Unknown type(%d)\n", sb.type); - return 0; + printf("Unknown type(%d)", sb.type); + sb.type = -1; + } + if (sb.type>=0 && dispatch_g[sb.type].name) { + fputs(dispatch_g[sb.type].name, stdout); } - if (dispatch_g[sb.type].name) fputs(dispatch_g[sb.type].name, stdout); /* * Open the object. Not all objects can be opened. If this is the case * then return right away. */ - if (NULL==dispatch_g[sb.type].open || - (obj=(dispatch_g[sb.type].open)(group, name))<0) return 0; + if (sb.type>=0 && + (NULL==dispatch_g[sb.type].open || + (obj=(dispatch_g[sb.type].open)(group, name))<0)) return 0; /* * List the first line of information for the object. */ - if (dispatch_g[sb.type].list1) (dispatch_g[sb.type].list1)(obj); + if (sb.type>=0 && dispatch_g[sb.type].list1) { + (dispatch_g[sb.type].list1)(obj); + } putchar('\n'); /* @@ -410,30 +1146,117 @@ list (hid_t group, const char *name, void __unused__ *cd) * which is common to all objects. */ if (verbose_g>0) { - H5Aiterate(obj, NULL, list_attr, NULL); + if (sb.type>=0) H5Aiterate(obj, NULL, list_attr, NULL); printf(" %-10s %lu:%lu:%lu:%lu\n", "Location:", sb.fileno[1], sb.fileno[0], sb.objno[1], sb.objno[0]); printf(" %-10s %u\n", "Links:", sb.nlink); if (sb.mtime>0 && NULL!=(tm=localtime(&(sb.mtime)))) { strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); - printf(" %-10s %s\n", "Modtime:", buf); + printf(" %-10s %s\n", "Modified:", buf); } comment[0] = '\0'; H5Gget_comment(group, name, sizeof(comment), comment); strcpy(comment+sizeof(comment)-4, "..."); if (comment[0]) printf(" %-10s %s\n", "Comment:", comment); } - if (dispatch_g[sb.type].list2) (dispatch_g[sb.type].list2)(obj); + if (sb.type>0 && dispatch_g[sb.type].list2) { + (dispatch_g[sb.type].list2)(obj); + } /* * Close the object. */ - (dispatch_g[sb.type].close)(obj); + if (sb.type>0) (dispatch_g[sb.type].close)(obj); return 0; } /*------------------------------------------------------------------------- + * Function: get_width + * + * Purpose: Figure out how wide the screen is. This is highly + * unportable, but the user can always override the width we + * detect by giving a command-line option. These code snippets + * were borrowed from the GNU less(1). + * + * Return: Success: Number of columns. + * + * Failure: Some default number of columms. + * + * Programmer: Robb Matzke + * Friday, November 6, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +get_width(void) +{ + int width = 80; /*the default */ + char *s; + + /* + * Try to get it from the COLUMNS environment variable first since it's + * value is sometimes wrong. + */ + if ((s=getenv("COLUMNS")) && *s && isdigit(*s)) { + width = strtol(s, NULL, 0); + } + +#if defined(HAVE_STRUCT_VIDEOCONFIG) && defined(HAVE__GETVIDEOCONFIG) + { + /* Microsoft C */ + struct videoconfig w; + _getvideoconfig(&w); + width = w.numtextcols; + } +#elif defined(HAVE_STRUCT_TEXT_INFO) && defined(HAVE_GETTEXTINFO) + { + /* Borland C or DJGPPC */ + struct text_info w; + gettextinfo(&w); + width = w.screenwidth; + } +#elif defined(HAVE_GETCONSOLESCREENBUFFERINFO) + { + /* Win32 C */ + CONSOLE_SCREEN_BUFFER_INFO scr; + GetConsoleScreenBufferInfo(con_out, &scr); + width = scr.srWindow.Right - scr.srWindow.Left + 1; + } +#elif defined(HAVE__SCRSIZE) + { + /* OS/2 */ + int w[2]; + _scrsize(w); + width = w[0]; + } +#elif defined(HAVE_TIOCGWINSZ) && defined(HAVE_IOCTL) + { + /* Unix with ioctl(TIOCGWINSZ) */ + struct winsize w; + if (ioctl(2, TIOCGWINSZ, &w)>=0 && w.ws_col>0) { + width = w.ws_col; + } + } +#elif defined(HAVE_TIOCGETD) && defined(HAVE_IOCTL) + { + /* Unix with ioctl(TIOCGETD) */ + struct uwdata w; + if (ioctl(2, WIOCGETD, &w)>=0 && w.uw_width>0) { + width = w.uw_width / w.uw_hs; + } + } +#endif + + /* Set to at least 1 */ + if (width<1) width = 1; + return width; +} + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Opens a file and lists the specified group @@ -465,7 +1288,7 @@ main (int argc, char *argv[]) DISPATCH(H5G_GROUP, "Group", H5Gopen, H5Gclose, NULL, NULL); DISPATCH(H5G_TYPE, "Type", H5Topen, H5Tclose, - NULL, NULL); + NULL, datatype_list2); DISPATCH(H5G_LINK, "-> ", link_open, NULL, NULL, NULL); DISPATCH(H5G_RAGGED, "Ragged Array", H5Gopen, H5Gclose, @@ -474,7 +1297,10 @@ main (int argc, char *argv[]) /* Name of this program without the path */ if ((progname=strrchr (argv[0], '/'))) progname++; else progname = argv[0]; - + + /* Default output width */ + width_g = get_width(); + /* Switches come before non-switch arguments */ for (argno=1; argno<argc && '-'==argv[argno][0]; argno++) { if (!strcmp(argv[argno], "--")) { @@ -485,7 +1311,9 @@ main (int argc, char *argv[]) usage(progname); exit(0); } else if (!strcmp(argv[argno], "--dump")) { - dump_g++; + dump_g = TRUE; + } else if (!strcmp(argv[argno], "--label")) { + label_g = TRUE; } else if (!strcmp(argv[argno], "--string")) { string_g = TRUE; } else if (!strncmp(argv[argno], "--width=", 8)) { @@ -525,7 +1353,10 @@ main (int argc, char *argv[]) case 'd': /* --dump */ dump_g++; break; - case 's': + case 'l': /* --label */ + label_g = TRUE; + break; + case 's': /* --string */ string_g = TRUE; break; case 'v': /* --verbose */ |